Welcome to the CHICKEN Scheme pasting service

file read tests pasted by Kooda on Sun Oct 8 16:05:08 2017

(use extras ports)

(print "read-line")
(time
  (with-input-from-file "world_bank.json"
    (lambda () (port-map identity read-line))))

(print "read-char")
(time
  (with-input-from-file "world_bank.json"
    (lambda () (port-map identity read-char))))

(print "read-string")
(time
  (with-input-from-file "world_bank.json"
    (lambda () (port-map identity (cut read-string 1024)))))

;; Results
;; =======
read-line
0.039s CPU time, 0.011s GC time (major), 9/2 mutations (total/tracked), 6/6 GCs (major/minor), maximum live heap: 3.09 MiB
read-char
1.422s CPU time, 0.588s GC time (major), 8/2 mutations (total/tracked), 9/2574 GCs (major/minor), maximum live heap: 68.2 MiB
read-string
[panic] out of memory - heap has reached its maximum size - execution terminated

...more...
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port
read-string/port        <--

Correct version added by sjamaan on Sun Oct 8 16:15:59 2017

(use extras ports)

(print "read-line")
(time
  (with-input-from-file "world_bank.json"
    (lambda () (port-map identity read-line))))

(print "read-char")
(time
  (with-input-from-file "world_bank.json"
    (lambda () (port-map identity read-char))))

(print "read-string")
(time
  (with-input-from-file "world_bank.json"
    (lambda ()
      (port-map identity (lambda ()
                           (let ((result (read-string 1024)))
                             (if (string=? "" result)
                                  #!eof
                                  result)))))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `string-intersperse'?
Visually impaired? Let me spell it for you (wav file) download WAV