Macro compilation time comparison added by jacius / jcroisant on Sun May 23 06:53:33 2021

A complex, real-world macro was implemented three times, using
syntax-rules, ir-macro-transformer, and er-macro-transformer, to
compare their compilation times and lines of code generated. In each
case the macro was duplicated 30 times with different names, to
simulate a library with many complex macros. Each implementation was
run against the same test suite to ensure correctness and measure
compilation time of code that uses the macros.

Compiled with Ubuntu 20.04.2 LTS, gcc version 9.3.0, Intel Core i5 CPU
@ 2.30GHz × 4, 7.6 GiB memory.


| measurement (unit)   |   sr5 |   ir5 |   er5 |   sr4 |   ir4 |   er4 |
|----------------------+-------+-------+-------+-------+-------+-------|
| compile egg (secs)   |  38.3 |   7.6 |  14.1 |  20.9 |   4.1 |   7.8 |
| scm to c only (secs) |   6.8 |   1.3 |   1.7 |   2.9 |   1.0 |   1.3 |
| csc test (secs)      |  13.2 |  12.7 |  13.7 |  13.0 |  13.2 |  13.8 |
| csi test (secs)      |  0.38 |  0.39 |  0.39 |  0.34 |  0.37 |  0.31 |
|----------------------+-------+-------+-------+-------+-------+-------|
| x.scm (lines)        |   907 |   925 |   925 |   907 |   925 |   925 |
| x.c (lines)          |   172 |   193 |   193 |   204 |   202 |   202 |
| x.import.scm (lines) |  1028 |   981 |  1161 |   980 |   931 |  1111 |
| x.import.c (lines)   | 56287 | 10803 | 20468 | 61348 | 11410 | 21793 |

(It is unexpected but correct that er-macro-transformer took longer to
compile than ir-macro-transformer. The reason is currently unknown.)


Key:

sr5 = syntax-rules, compiled with CHICKEN 5.2.1
ir5 = ir-macro-transformer, compiled with CHICKEN 5.2.1
er5 = er-macro-transformer, compiled with CHICKEN 5.2.1
sr4 = syntax-rules, compiled with CHICKEN 4.13
ir4 = ir-macro-transformer, compiled with CHICKEN 4.13
er4 = er-macro-transformer, compiled with CHICKEN 4.13

compile egg   = chicken-install -nk
scm to c only = CSC_OPTIONS="-t" chicken-install -n
csc test      = csc -02 test.scm
csi test      = csi -s test.scm