From 921ae00b825640d00b576c1098bd92bb2e166de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 22 Aug 2020 23:56:53 +0200 Subject: Some benchmarking impmrovements. --- module/calp/benchmark/parse.scm | 4 ++++ module/calp/entry-points/benchmark.scm | 11 ++++++----- module/calp/main.scm | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/module/calp/benchmark/parse.scm b/module/calp/benchmark/parse.scm index 68a6d5ff..e9bc509f 100644 --- a/module/calp/benchmark/parse.scm +++ b/module/calp/benchmark/parse.scm @@ -12,6 +12,7 @@ (define all-calendar-files (statprof (lambda () + (display "All calendar files\n") (concatenate (map (lambda (path) (map @@ -23,6 +24,7 @@ (define all-read (statprof (lambda () + (display "All read\n") (map (lambda ( fullname) (let ((cal (call-with-input-file fullname (@@ (vcomponent ical parse) read-file)))) @@ -32,6 +34,7 @@ (define tokenized (statprof (lambda () + (display "Tokenized\n") (map (lambda (one-read) (map (@@ (vcomponent ical parse) tokenize) one-read)) @@ -40,6 +43,7 @@ (define parsed (statprof (lambda () + (display "Parsed\n") (map (@@ (vcomponent ical parse) parse) tokenized)))) (format #t "~a files processed~%" diff --git a/module/calp/entry-points/benchmark.scm b/module/calp/entry-points/benchmark.scm index 8eaf3731..7706f6f0 100644 --- a/module/calp/entry-points/benchmark.scm +++ b/module/calp/entry-points/benchmark.scm @@ -28,8 +28,9 @@ (throw 'return)) - (awhen (option-ref opts '() #f) - ((module-ref (resolve-module - `(calp benchmark ,@(map string->symbol it))) - 'run-benchmark))) -) + (let ((opt (option-ref opts '() #f))) + (if (null? opt) + (print-arg-help opt-spec) + ((module-ref (resolve-module + `(calp benchmark ,@(map string->symbol opt))) + 'run-benchmark))))) diff --git a/module/calp/main.scm b/module/calp/main.scm index 709658d8..040a7c00 100644 --- a/module/calp/main.scm +++ b/module/calp/main.scm @@ -83,8 +83,8 @@ "reserializes it back into ICAL format. " "Useful for merging calendars.") - (p (b "benchmark") " Forces a field from the current app. Preferably used together with " - (i "--statprof") " for some for profiling the code.") + (p (b "benchmark") " " (i "module") (br) + "Runs the procedure 'run-benchmark' from the module (calp benchmark " (i "module") ").") (p (b "server") " starts an HTTP server which dynamicly loads and displays event. The " (i "/month/{date}.html") " & " (i "/week/{date}.html") " runs the same output code as " -- cgit v1.2.3