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.



Reply via email to