On Sat 31 Aug 2013 12:19, l...@gnu.org (Ludovic Courtès) writes: > Andy Wingo <wi...@pobox.com> skribis: > >> I just took a look at your program, which ran in 40s on my machine. >> Under callgrind it turned out that we were doing a lot of iconv stuff >> that we didn't need to do. > > It’s often the case that I/O is faster if you explicitly say that the > port is UTF-8-encoded, because there’s a fast path for that (not using > iconv) in 2.0: > > (with-fluids ((%default-port-encoding "UTF-8")) > (call-with-input-file file > ...))
Yep. In this particular case, it turned out that even in UTF-8 locales, scm_ungetc_unlocked and scm_from_port_string were going through iconv. Fixing that sped up the test by around 600% (!!). Andy -- http://wingolog.org/