Hola! Aleix Conchillo Flaqué <aconchi...@gmail.com> skribis:
> On guile-json 3.5.0 (still using (string-append)) the first execution time > goes from 19 seconds to 42 seconds. Then, the times keep increasing as in > version 2.2.7 but numbers are much bigger: With Guile 3.0.2 and Guile-JSON 3.5.0, I get: --8<---------------cut here---------------start------------->8--- $ guile GNU Guile 3.0.2 Copyright (C) 1995-2020 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> ,use(json) scheme@(guile-user)> ,t (->bool (call-with-input-file "/tmp/large-file.json" json->scm)) $1 = #t ;; 55.142128s real time, 79.806656s run time. 65.418070s spent in GC. scheme@(guile-user)> ,t (->bool (call-with-input-file "/tmp/large-file.json" json->scm)) $2 = #t ;; 47.416645s real time, 75.274219s run time. 62.421108s spent in GC. scheme@(guile-user)> ,t (->bool (call-with-input-file "/tmp/large-file.json" json->scm)) $3 = #t ;; 41.292368s real time, 79.053120s run time. 67.266710s spent in GC. --8<---------------cut here---------------end--------------->8--- So I think the time increase was just due to the fact that previous parse results were kept around, somehow. 2.2.7 performs comparably for me: --8<---------------cut here---------------start------------->8--- $ guix environment -C --ad-hoc guile-json guile@2.2 --share=/tmp -- guile guix environment: warning: plursenca pak-specifigo 'guile@2.2' guix environment: warning: choosing guile@2.2.7 from gnu/packages/guile.scm:256:2 GNU Guile 2.2.7 Copyright (C) 1995-2019 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> ,use(json) scheme@(guile-user)> ,t (->bool (call-with-input-file "/tmp/large-file.json" json->scm)) $1 = #t ;; 44.963180s real time, 90.606198s run time. 71.529811s spent in GC. scheme@(guile-user)> ,t (->bool (call-with-input-file "/tmp/large-file.json" json->scm)) $2 = #t ;; 44.147740s real time, 87.796937s run time. 69.818018s spent in GC. scheme@(guile-user)> ,t (->bool (call-with-input-file "/tmp/large-file.json" json->scm)) $3 = #t ;; 45.057761s real time, 89.689930s run time. 71.370764s spent in GC. --8<---------------cut here---------------end--------------->8--- So to me, Guile is behaving correctly here. Now, it would be good to profile ‘json->scm’ to see if there’s anything that could be improved on the Guile side, or if it’s just a normal profile for GC-intensive code. Thanks, Ludo’.