Hi Gambit List,
What's the quickest way of reading a file from disk into memory?
I tried 'read-all' with 'read-line', but unfortunately even with compiling I get an order of magnitude worse performance than doing the same in python. I'm using the following code, compiled using gsc and gcc -O3, and I get 500ms to read the 'bib' file supplied in the bench.tgz package.
----------------------
(define (f) (call-with-input-file "bib" (lambda (p) (read-all p read-line))))
(time (f))
------------------------
In python, the same takes about 50ms e.g. for line in file("bib").readlines(): # do something
Is there anything I can do to speed this up? (I've tried setting #define ___MAX_CHR 0xff )
Many thanks,
Phil
Afficher les réponses par date