Comment 1 for bug 557357

Revision history for this message
Lutz Euler (lutz-euler) wrote :

64-bit SBCL under Linux spends most of its startup time in "gc_init".
This is easy to improve.

I measured the following runtimes for your "Hello world" scripts/images:

Perl: 0.009 s
SBCL 32-Bit: 0.025 s
SBCL 64-Bit: 0.080 s

With the attached patch this improves as follows:

patched 32-Bit: 0.022 s
patched 64-Bit: 0.020 s

Here is the output of "/usr/bin/time ./hello-world" (edited for readability)
for the 64-bit version which shows that the memory footprint is reduced
notedly, too:

Originally:
0:00.07 elapsed
145152 K maxresident
17632 minor pagefaults

With the patch:
0:00.01 elapsed
14768 K maxresident
1295 minor pagefaults

The patch simply removes an unnecessary initialization loop for the array
"page_table_pages" that defeats the operating system's and C library's
efforts to make "calloc" efficient. Please see the comment in the patch
for details.

Please take the patch as preliminary. Given some help, I would like to
improve it:

* As there is a small improvement for 32-bit SBCL, too, not only gencgc
  platforms may be affected. I have not yet looked at "cheneygc.c" but
  presumably that is the only other file in active use containing a
  definition of "gc_init"?
* Without the loop the page structures are correctly initialized only
  as long as FREE_PAGE_FLAG == 0. Thus, for maintainability, an assertion
  or at least a comment at the right place seems sensible.
  If the former: Is there an SBCL way for compile-time assertions in C files?
  If the latter: Any suggestions where a warning should be placed?
* The comment in the patch is too long and I would like to reword it.
  Should these explanations instead be put somewhere else, possibly the
  documentation?
* Presumably, all unixoid operating systems behave the same as Linux here.
  I am curious if that is indeed the case on Solaris, the BSD's and the Mac
  but can't verify this myself.

Kind regards,

Lutz