(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 <--