Attached is a patch that records the value of Free on entry to each
primitive, so that Primitive_GC can add the amount the primitive has
bumped Free so far to the number of words currently being requested.
This way, primitives performing multiple separate allocations each
with its own GC check won't go into loops.  The change is simpler than
I thought it would be when I wrote the long-winded message last week.

I performed some not particularly scientific tests which indicated
that this patch made compiling the whole system take about .5% more
time.  I think that is an acceptable cost for making the system more
robust, but perhaps you may disagree.  (Summary of the performance
comparison attached.)

Any objections to committing this?

Attachment: fix-prim-gc.patch
Description: Binary data

I compared the performance of the microcode before and after recording
Free_primitive, ../../ucode-20110624-0/src/microcode/scheme being the
`before' and ../../ucode-20110624-1/src/microcode/scheme being the
`after', on compiling the whole system.  I first removed all existing
compiled code, and then filled the OS's disk buffer cache by tarring up
the microcode, band, and target system's source code to /dev/null; the
system has enough RAM that everything involved should be cached in it,
although writing output files entails writing to disk.  (Probably ought
to have run it on tmpfs instead.)  I left the machine largely idle
while running each test.  For one run, I ran both tests almost
simultaneously, started about a half a second apart from one another;
this is a dual-core machine, so the times were only a little different,
not doubled.

Command-line invocation:

% (find . -name '*.pkd' -o -name '*.crf' -o -name '*.fre' -o -name '*.bin' -o 
-name '*.ext' -o -name '*.bci' -o -name '*.com' | xargs rm) && (cd compiler && 
./configure i386) && (tar --insecure -c -f - 
../../ucode-20110624-0/src/microcode/scheme 
/usr/local/mit-scheme/current/lib/mit-scheme-i386 . > /dev/null) && time env -i 
PATH=/bin:/usr/bin 
MITSCHEME_LIBRARY_PATH=/usr/local/mit-scheme/current/lib/mit-scheme-i386 
../../ucode-20110624-0/src/microcode/scheme --heap 6000 --stack 200 
--batch-mode <<EOF
(begin (load "etc/compile") (show-time compile-everything))
EOF

Timings before change:

;process time: 917050 (735570 RUN + 181480 GC); real time: 1180470
917.22s user 217.50s system 96% cpu 19:41.02 total

;process time: 849810 (671450 RUN + 178360 GC); real time: 1111195
850.00s user 221.89s system 96% cpu 18:31.74 total

;process time: 850080 (672490 RUN + 177590 GC); real time: 1114162
850.26s user 222.48s system 96% cpu 18:34.72 total

;process time: 847680 (669580 RUN + 178100 GC); real time: 1113583
847.85s user 221.42s system 95% cpu 18:34.30 total

(simultaneous run)
;process time: 867560 (686510 RUN + 181050 GC); real time: 1259814
867.74s user 231.27s system 87% cpu 21:00.52 total


Timings after change:

;process time: 858270 (679380 RUN + 178890 GC); real time: 1125450
858.50s user 221.99s system 95% cpu 18:46.13 total

;process time: 852060 (674010 RUN + 178050 GC); real time: 1111186
852.22s user 217.95s system 96% cpu 18:31.86 total

;process time: 851190 (672510 RUN + 178680 GC); real time: 1117069
851.39s user 224.58s system 96% cpu 18:37.84 total

;process time: 851990 (671880 RUN + 180110 GC); real time: 1113746
852.13s user 218.08s system 96% cpu 18:34.32 total

(simultaneous run)
;process time: 870680 (687600 RUN + 183080 GC); real time: 1260346
870.85s user 231.22s system 87% cpu 21:01.03 total
_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to