blob: e9bc509f72aaaa395358001587a7730be8a7722b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
(define-module (calp benchmark parse)
:use-module (util)
:use-module (glob)
:use-module (statprof)
:use-module ((srfi srfi-1) :select (concatenate))
:use-module ((ice-9 ftw) :select (scandir))
)
(define-public (run-benchmark)
(define all-calendar-files
(statprof
(lambda ()
(display "All calendar files\n")
(concatenate
(map (lambda (path)
(map
(lambda (fname) (path-append path fname))
(scandir path (lambda (s) (and (not (string= "." (string-take s 1)))
(string= "ics" (string-take-right s 3)))))))
(glob "~/.local/var/cal/*"))))))
(define all-read
(statprof
(lambda ()
(display "All read\n")
(map (lambda ( fullname)
(let ((cal (call-with-input-file fullname
(@@ (vcomponent ical parse) read-file))))
cal))
all-calendar-files))))
(define tokenized
(statprof
(lambda ()
(display "Tokenized\n")
(map (lambda (one-read)
(map (@@ (vcomponent ical parse) tokenize)
one-read))
all-read))))
(define parsed
(statprof
(lambda ()
(display "Parsed\n")
(map (@@ (vcomponent ical parse) parse) tokenized))))
(format #t "~a files processed~%"
(length parsed))
)
|