[toronto-lisp] Effecient I/O in SBCL

Dimitre Liotev dl at znain.net
Wed Sep 3 21:26:52 UTC 2008


Abram Hindle <abram.hindle at softwareprocess.us> writes:

> I was running into problems with performance with SBCL.
> I want to read huge CSV files and convert ASCII representations of
> floats to floats.
>
> A. what's an effecient way to convert a string to a float

Here is a good discussion:

http://groups.google.ca/group/comp.lang.lisp/browse_thread/thread/92d22492f4c93e72/bbf23b3aa5b44698?hl=en&lnk=st&q=lisp+read+string+to+float#bbf23b3aa5b44698

> B. what's an effecient way to read lines from a file

Different ways for "slurping" a file, including line by line, with benchmarks:

http://www.emmett.ca/~sabetts/slurp.html

> C. what's an effecient way to split substrings from a string (I don't
> need to keep them around after I throw away the line)

Depending on the complexity of the splitting, use either split-sequence
(http://www.cliki.net/SPLIT-SEQUENCE) or cl-ppcre
(http://weitz.de/cl-ppcre/) - the latter is very fast.


-- 
Dimitre Liotev



More information about the toronto-lisp mailing list