Racket: launching racket repl iconv_open/closes ~45,000 times

Created on 5 Aug 2019  路  6Comments  路  Source: racket/racket

Launching racket and doing nothing racket -e '(exit)' with a non-chez Racket 7.3 on an illumos or Solaris x86 system takes about 35 seconds.

It turns out that it's calling iconv_open/iconv_close pairs about 45,000 times

I don't know about other systems, but on solaris-derived systems iconv_open and iconv_close call dlopen/dlclose to load/unload per-character-set-pair modules.
This round-trip into the runtime linker, per-file? per-string? is incredibly bad for performance

It'd be far better to keep the iconv_t around in rktio somewhere.

Most helpful comment

Built from "Source + built packages"

; ptime /opt/racket/bin/racket -e '(exit)'

real        0.391080353
user        0.332160094
sys         0.058486092

_so_ much better. Superheroic. Thank you _so_ much.

All 6 comments

Thanks @richlowe
That's a really interesting report - fixing that could potentially improve start up time by quite a bit.

I have an implementation of caching a converter that I want to check a little more before pushing.

@richlowe Just to double-check, does racket -c -e (exit) take even longer than 35 seconds? I ask because 35 second is about how long it should take to start Racket without collections compiled to bytecode.

Yes, without -c it takes longer.

@richlowe If you have time, please try building the latest snapshot from https://www.cs.utah.edu/plt/snapshots/ to see if it's better with the changes to cache converters.

Built from "Source + built packages"

; ptime /opt/racket/bin/racket -e '(exit)'

real        0.391080353
user        0.332160094
sys         0.058486092

_so_ much better. Superheroic. Thank you _so_ much.

Closing given all is well. @richlowe feel free to open a new issue if something else comes up.

Was this page helpful?
0 / 5 - 0 ratings