[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fast float parsing?
- To: firstname.lastname@example.org
- Subject: fast float parsing?
- From: email@example.com (Stephen C. Gilardi)
- Date: Wed, 4 Nov 1992 18:51:10 -0500
I have a need to read a machine generated text file containing text
representations of floating point numbers. I open a stream onto the
file and currently I am using the following to parse the floats:
(defun parse-float (s)
The problem with this is that it runs very slowly. It allocates about
150 bytes of memory per float read (technically I guess I'm really
reading doubles). This gets really slow because of all the garbage
collecting in reading say 1000 floats.
Does anyone have some code or hints for speeding this up?
Bonus question: I also have to read some complex numbers in a format
like the following:
For now I do (set-syntax-from-char #\, #\space) and then use two calls
to parse-float above. Can I improve that?
I noted some support for SANE (particularly Str2Dec) included with beta
versions of MCL 2.0 (on the CD), that seems to have been dropped with
I'm reading these floats into vectors.
Stephen C. Gilardi