Mark H Weaver skribis:
> Indeed, the implementation of 'string-join' was very bad: about O(n^2)
[...]
> Before:
>
> scheme@(guile-user)> ,time (define s (string-join (make-list 1 "test")
> "-"))
> ;; 0.998800s real time, 0.996677s run time. 0.984885s spent in GC.
> scheme@(guile-user)> ,t
Hello,
sorry for the repeated message earlier.
Ok, i think it's clear that all these double indirections can be eliminated
globally by composing the strides of the array descriptor with the stride of
SCM_I_ARRAY_V (array) and using that directly in the array descriptor. Is there
any reason n
This patch is for array-for-each. Only the first argument.
Before:
scheme@(guile-user)> (define a (make-array 1 100 10))
scheme@(guile-user)> ,time (let ((x 0)) (array-for-each (lambda (a) (set! x (+
a x))) a) x)
$8 = 1000
;; 0.621887s real time, 0.620181s run time. 0.00s spent in
On Apr 2, 2013, at 12:19, Daniel Llorens wrote:
> On Apr 1, 2013, at 19:15, Daniel Llorens wrote:
>
>> Third, none of the above are causing the slowness of array-copy!. I noticed
>> that there's a double indirection in racp(). The second patch removes it.
>> Actually this double indirection go
On Apr 2, 2013, at 12:19, Daniel Llorens wrote:
> On Apr 1, 2013, at 19:15, Daniel Llorens wrote:
>
>> Third, none of the above are causing the slowness of array-copy!. I noticed
>> that there's a double indirection in racp(). The second patch removes it.
>> Actually this double indirection go
On Apr 1, 2013, at 19:15, Daniel Llorens wrote:
> Third, none of the above are causing the slowness of array-copy!. I noticed
> that there's a double indirection in racp(). The second patch removes it.
> Actually this double indirection goes on all over array-map.c and I don't
> understand why
> Message: 5
> Date: Mon, 1 Apr 2013 15:40:48 +0800
> From: Daniel Hartwig
> To: guile-devel@gnu.org
> Subject: Re: Extremly slow for format & string-join
> On 1 April 2013 14:59, Daniel Llorens wrote:
>> How can it be slower to allocate the result at once?
>
Nala Ginrut writes:
> string-join is a common thing for text processing(include web develop).
> However, our powerful 'format' is not so efficient. I do think it's
> necessary to we spend some time on it.
As Mark says, format is a not very nice piece of code to read, or to
modify, so if you want
() Nala Ginrut
() Mon, 01 Apr 2013 12:00:01 +0800
(define (str* str n)
(format #f "~{~a~}" (make-list n str)))
(define (str* str n)
(string-join (make-list n str) ""))
Here's another implementation, using SRFI 13 ‘xsubstring’:
(define (str* str n)
(xsubstring str 0 (* n (stri
On Mon, 2013-04-01 at 04:36 -0400, Mark H Weaver wrote:
> Nala Ginrut writes:
>
> > I've tried to implement a function to mimic string multiply like Python:
> > "asdf" * 10
> >
> > --code
> > (define (str* str n)
> > (format #f "~{~a~}" (make-list n str)))
> >
> > or
Nala Ginrut writes:
> I've tried to implement a function to mimic string multiply like Python:
> "asdf" * 10
>
> --code
> (define (str* str n)
> (format #f "~{~a~}" (make-list n str)))
>
> or
>
> (define (str* str n)
> (string-join (make-list n str) ""))
>
On 1 April 2013 14:59, Daniel Llorens wrote:
>
> Hello,
>
>> From: Daniel Hartwig
>>
>> (define (str* str n)
>> (call-with-output-string
>>(lambda (p)
>> (let lp ((n n))
>>(unless (zero? n)
>> (display str p)
>> (lp (1- n)))
>>
>> Out of curiousity, how doe
On 1 April 2013 14:58, Nala Ginrut wrote:
> On Mon, 2013-04-01 at 13:35 +0800, Daniel Hartwig wrote:
>> 2013/4/1 Nala Ginrut :
>> > Anyway, string-join is so slowly beyond my expectation.
>>
>> Also note that ‘string-concatenate’ (less general than ‘string-join’)
>> performs better for the same ca
Hello,
> From: Daniel Hartwig
>
> 2013/4/1 Nala Ginrut :
>> I've tried to implement a function to mimic string multiply like Python:
>> "asdf" * 10
>>
>> --code
>> (define (str* str n)
>> (format #f "~{~a~}" (make-list n str)))
>>
>> or
>>
>> (define (str* str n)
On Mon, 2013-04-01 at 13:35 +0800, Daniel Hartwig wrote:
> 2013/4/1 Nala Ginrut :
> > Anyway, string-join is so slowly beyond my expectation.
>
> Also note that ‘string-concatenate’ (less general than ‘string-join’)
> performs better for the same case, you could use that directly instead
> of my p
2013/4/1 Nala Ginrut :
> Anyway, string-join is so slowly beyond my expectation.
Also note that ‘string-concatenate’ (less general than ‘string-join’)
performs better for the same case, you could use that directly instead
of my prior suggestion for similar results. Especially since you do
not des
On Mon, 2013-04-01 at 12:39 +0800, Daniel Hartwig wrote:
> 2013/4/1 Nala Ginrut :
> > I've tried to implement a function to mimic string multiply like Python:
> > "asdf" * 10
> >
> > --code
> > (define (str* str n)
> > (format #f "~{~a~}" (make-list n str)))
> >
> > or
2013/4/1 Nala Ginrut :
> I've tried to implement a function to mimic string multiply like Python:
> "asdf" * 10
>
> --code
> (define (str* str n)
> (format #f "~{~a~}" (make-list n str)))
>
> or
>
> (define (str* str n)
> (string-join (make-list n str) ""))
> ---
I've tried to implement a function to mimic string multiply like Python:
"asdf" * 10
--code
(define (str* str n)
(format #f "~{~a~}" (make-list n str)))
or
(define (str* str n)
(string-join (make-list n str) ""))
--end-
Both are very
19 matches
Mail list logo