[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read integers from file faster?

From: Andy Wingo
Subject: Re: How to read integers from file faster?
Date: Sun, 01 Sep 2013 10:45:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

On Sat 31 Aug 2013 12:19, address@hidden (Ludovic Courtès) writes:

> Andy Wingo <address@hidden> 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% (!!).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]