[gambit-list] Universal backend progress
Marc Feeley
feeley at iro.umontreal.ca
Thu Apr 2 00:21:49 EDT 2020
The universal backend has reached a new milestone. There is now a --enable-targets=… configure option to enable individual target languages in addition to C. Currently JavaScript and Python are supported.
The universal backend is sufficiently feature-full to compile the gsi interpreter and builtin modules and support the module system and dynamically loading compiled modules:
% ./configure --enable-targets=js,python --enable-single-host
% make
% make modules
% gsc/gsc -:= -target js -exe -o gsi/gsi-js -prelude '(include"~~lib/header.scm")' gsi/_gsi.scm
% gsc/gsc -:= -target python -exe -o gsi/gsi-python -prelude '(include"~~lib/header.scm")' gsi/_gsi.scm
% gsi/gsi lib/ _test/test
*** all tests passed out of a total of 40 tests
% gsi/gsi-js lib/ _test/test
*** all tests passed out of a total of 40 tests
% gsi/gsi-python lib/ _test/test
*** all tests passed out of a total of 40 tests
% gsc/gsc -:= -target js fib.scm
% gsi/gsi-js fib.o1
(time (fib 30))
0.078000 secs real time
0.078000 secs cpu time (0.078000 user, 0.000000 system)
no collections
no bytes allocated
no minor faults
no major faults
832040
% gsi/gsi-js fib.scm
(time (fib 30))
1.877000 secs real time
1.877000 secs cpu time (1.877000 user, 0.000000 system)
no collections
no bytes allocated
no minor faults
no major faults
832040
% gsi/gsi fib.scm
(time (fib 30))
0.243592 secs real time
0.243565 secs cpu time (0.241976 user, 0.001589 system)
20 collections accounting for 0.001477 secs real time (0.001463 user, 0.000023 system)
172322368 bytes allocated
2028 minor faults
no major faults
832040
So the JavaScript backend generates code that is about 8x slower than the code generated by the C backend.
Marc
More information about the Gambit-list
mailing list