This is the trivial-time Reference Manual, version 0.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Fri May 15 13:09:06 2026 GMT+0.
The main system appears first, followed by any subsystem dependency.
trivial-timetrivial-time allows timing a benchmarking a piece of code portably
Artyom Bologov
(GIT https://codeberg.org/aartaka/trivial-time.git)
BSD-2 Clause
0.0.0
package.lisp (file).
trivial-time.lisp (file).
Files are sorted by type and then listed depth-first from the systems components trees.
trivial-time/trivial-time.lisppackage.lisp (file).
trivial-time (system).
%benchmark (generic function).
%time (generic function).
Packages are listed by definition order.
trivial-time‘trivial-time’ provides two macros for code timing/benchmarking: - ‘time’ counts the time, GC stats, and error rate of the code. - ‘benchmark’ runs the code X times and prints the aggregate stats.
There’s also ‘with-time’ as the underlying implementation between these, available for use outside them.
common-lisp.
%benchmark (generic function).
%time (generic function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Run FORMS REPEAT times, recording ‘time’-ing data per every run.
Print the total and average statistics across the runs.
Return the values returned by the last evaluation of FORMS.
REPEAT defaults to 1000.
Affected by:
- ‘with-time’ implementation support.
- ‘*trace-output*’ for printing.
- Print variables for float format and form printing.
Bear in mind: some implementations take considerable time for these measurements, so the run time might add up to more than the actual code run time. Use caution.
Execute FORMS and print timing information for them. The values of last form in FORMS are returned unaltered.
Affected by:
- ‘with-time’ implementation support.
- ‘*trace-output*’ for printing.
- Printer variables for float format and form printing.
Measure the timing properties for FORM and bind them to TIME-KEYWORDS in BODY.
The values of FORM are bound to MULTIPLE-VALUE-ARGS.
Both TIME-KEYWORDS and MULTIPLE-VALUE-ARGS are destructuring lists,
allowing for &REST, &KEY etc. in them.
TIME-KEYWORDS is a &KEY destructuring list, but one may omit &KEY and
&ALLOW-OTHER-KEYS in it.
TIME-KEYWORDS are destructuring a keyword-indexed property list with:
- :REAL — for real time (in seconds, float).
- :USER — for user-space CPU use/run time (in seconds, float).
- :SYSTEM — for system-space CPU use/run time (in seconds, float).
- :CYCLES — for CPU cycles spent.
- :GC-COUNT — for the times GC was invoked.
- :GC — for time spend on GC (in seconds, float).
- :ALLOCATED — for the amount of bytes consed.
- :ABORTED — for whether the evaluation errored out.
- :FAULTS — for the number of page faults (both major and minor).
Not all of properties are guaranteed to be there. More so: it’s almost
always the case that some are missing.
Example of use:
(with-time (real user gc allocated)
()
(apropos "")
(format t "~&Real ~f~
~&User ~f~
~&GC ~f~
~&Allocated ~a" real user gc allocated))
| Jump to: | %
B G M T W |
|---|
| Jump to: | %
B G M T W |
|---|
| Jump to: | F P S T |
|---|
| Jump to: | F P S T |
|---|