unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* string-for-each vs. for-each+string->list performance
@ 2020-06-07  6:27 Aleix Conchillo Flaqué
  2020-06-07  6:33 ` Aleix Conchillo Flaqué
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Aleix Conchillo Flaqué @ 2020-06-07  6:27 UTC (permalink / raw)
  To: guile-user

Hi,

in the latest guile-json, 4.1.0. I changed some code to use
for-each+string->list. The performance seemed nice and I released it.

Christopher Lam pointed out that I could have used string-for-each instead.
I made the change but the performance degraded a lot:

string-for-each:

scheme@(json parser)> ,t (->bool (scm->json-string json))
$19 = #t
;; 17.909537s real time, 18.063382s run time.  0.207281s spent in GC.

vs

for-each + string->list:

scheme@(json parser)> ,t (->bool (scm->json-string json))
$20 = #t
;; 2.998381s real time, 3.319349s run time.  0.471969s spent in GC.

string-for-each is implemented in scheme here, if Im not wrong:

http://git.savannah.gnu.org/cgit/guile.git/tree/module/rnrs/base.scm#n89

string->list and for-each would use C.

Is that huge gap expected?

This is with Guile 3.0.2.

Best,

Aleix


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-13  6:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07  6:27 string-for-each vs. for-each+string->list performance Aleix Conchillo Flaqué
2020-06-07  6:33 ` Aleix Conchillo Flaqué
2020-06-07 11:20 ` Linus Björnstam
2020-06-07 13:50 ` Linus Björnstam
2020-06-12 20:13   ` Ludovic Courtès
2020-06-13  6:41     ` Linus Björnstam

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).