unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Extremly slow for format & string-join
@ 2013-04-01  4:00 Nala Ginrut
  2013-04-01  4:39 ` Daniel Hartwig
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Nala Ginrut @ 2013-04-01  4:00 UTC (permalink / raw)
  To: guile-devel

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 slow when N is large (> 1000000).

For 'format':
================profile==============
time   seconds     seconds      name
 73.90   1089.05   1089.04  length
 23.61    347.92    347.92  list-tail
  0.78   1473.57     11.46  format:format-work
  0.60      8.84      8.84  get-output-string
  0.28      4.15      4.15  display
=================end=================


For 'string-join', is shows that the C implementation of string-join is
the bottleneck.

I have no time to dig into, just report it.

Regards.





^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <mailman.1257260.1364793213.854.guile-devel@gnu.org>]

end of thread, other threads:[~2013-04-02 15:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01  4:00 Extremly slow for format & string-join Nala Ginrut
2013-04-01  4:39 ` Daniel Hartwig
2013-04-01  5:13   ` Nala Ginrut
2013-04-01  5:35     ` Daniel Hartwig
2013-04-01  6:58       ` Nala Ginrut
2013-04-01  7:02         ` Daniel Hartwig
2013-04-01  8:36 ` Mark H Weaver
2013-04-01  9:52   ` Nala Ginrut
2013-04-01 12:55     ` Ian Price
2013-04-02 15:56   ` Ludovic Courtès
2013-04-01 10:37 ` Thien-Thi Nguyen
     [not found] <mailman.1257260.1364793213.854.guile-devel@gnu.org>
2013-04-01  6:59 ` Daniel Llorens
2013-04-01  7:40   ` Daniel Hartwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).