kaleb@thyme.jpl.nasa.gov (Kaleb Keithley ) (09/01/90)
Recently (yesterday) I posted an article evaluating the use of GNU emacs malloc() and free() vs. SunOS malloc() and free(). In the quest for ever faster performance, today I investigated the malloc() and free() used in Larry Walls' perl. To recap the setup: Sun 4/60 (SS1), SunOS 4.1, 8M RAM, and CG3 framebuffer. Server code, Xdmcp, Xau, extensions, and malloc compiled -O3 -pg X11R4.14 Xsun started from command line, x11perf -all. Approximate run time: one hour, 45 minutes. Further below are the appropriate sections from the gprof output, but in summary, Perl malloc currently takes the blue ribbon, saving 75 seconds over SunOS malloc. Perl free saves 156 seconds over SunOS free. Quite surprising, to me anyway, is that perl malloc shaves 12 seconds off the emacs malloc, and perl free shaves 7 seconds from emacs free; Considering that both perl and emacs malloc have common roots, i.e. 4.3 bsd, with mods by Caltech. Perhaps Larry Wall and Richard Stallman should put their heads together and go back to the drawing board for GNUs' alpha/beta malloc! Now I've heard that cnews has a fast malloc; next week I'll try that and report back. ======================================================================== gprof malloc: SunOS: 0.00 0.00 1/6649310 _dbm_open [550] 0.00 0.00 1/6649310 __default_domain [767] 0.00 0.00 1/6649310 _load_dom_binding [591] 0.00 0.00 2/6649310 __findbuf [628] 0.00 0.00 2/6649310 _on_exit [757] 0.00 0.00 2/6649310 _clntudp_bufcreate [621] 0.00 0.00 3/6649310 _calloc [737] 0.00 0.00 28/6649310 _v2domatch [475] 0.00 0.00 28/6649310 _xdr_bytes [607] 0.00 0.00 140/6649310 _makenode [626] 0.17 0.10 13889/6649310 _Xrealloc [162] 0.22 0.13 17715/6649310 _realloc [171] 80.61 49.79 6617498/6649310 _Xalloc [57] [63] 2.4 81.00 50.03 6649310 _malloc [63] 43.41 0.00 5745550/5745550 _demote [118] 3.28 2.94 903760/6954542 _delete [111] 0.36 0.03 81/81 _morecore [338] ------------------------------------------------------------------------ GNU alpha: 224678 _malloc [75] 0.00 0.00 1/7779831 _dbm_open [567] 0.00 0.00 1/7779831 __default_domain [749] 0.00 0.00 1/7779831 _load_dom_binding [591] 0.00 0.00 2/7779831 __findbuf [479] 0.00 0.00 2/7779831 _on_exit [743] 0.00 0.00 2/7779831 _clntudp_bufcreate [604] 0.00 0.00 3/7779831 _calloc [721] 0.00 0.00 28/7779831 _v2domatch [510] 0.00 0.00 28/7779831 _xdr_bytes [627] 0.00 0.00 140/7779831 _makenode [608] 0.17 0.01 13893/7779831 _Xrealloc [175] 4.22 0.28 348143/7779831 _realloc [187] 90.00 5.95 7417587/7779831 _Xalloc [67] [75] 1.8 94.40 6.24 7779831+224678 _malloc [75] 0.30 5.44 8937/8937 _morecore [223] 0.01 0.49 849/10780 ___default_morecore [219] 0.00 0.00 1/1 _initialize [638] 224678 _malloc [75] ------------------------------------------------------------------------ GNU emacs: 0.00 0.00 1/8155300 _dbm_open [577] 0.00 0.00 1/8155300 __default_domain [762] 0.00 0.00 1/8155300 _load_dom_binding [631] 0.00 0.00 2/8155300 __findbuf [622] 0.00 0.00 2/8155300 _on_exit [757] 0.00 0.00 2/8155300 _clntudp_bufcreate [632] 0.00 0.00 3/8155300 _calloc [737] 0.00 0.00 28/8155300 _v2domatch [462] 0.00 0.00 28/8155300 _xdr_bytes [652] 0.00 0.00 140/8155300 _makenode [627] 0.11 0.00 13893/8155300 _Xrealloc [204] 2.22 0.02 271829/8155300 _realloc [221] 64.22 0.48 7869370/8155300 _Xalloc [85] [96] 1.3 66.56 0.49 8155300 _malloc [96] 0.03 0.46 727/727 _morecore [323] ------------------------------------------------------------------------ Perl: 0.00 0.00 1/8193716 _dbm_open [578] 0.00 0.00 1/8193716 __default_domain [756] 0.00 0.00 1/8193716 _load_dom_binding [584] 0.00 0.00 2/8193716 __findbuf [613] 0.00 0.00 2/8193716 _on_exit [751] 0.00 0.00 2/8193716 _clntudp_bufcreate [601] 0.00 0.00 3/8193716 _calloc [729] 0.00 0.00 28/8193716 _v2domatch [511] 0.00 0.00 28/8193716 _xdr_bytes [644] 0.00 0.00 140/8193716 _makenode [620] 0.09 0.00 13889/8193716 _Xrealloc [184] 2.45 0.02 366998/8193716 _realloc [196] 52.19 0.45 7812621/8193716 _Xalloc [95] [101] 1.0 54.74 0.47 8193716 _malloc [101] 0.26 0.21 698/698 _morecore [323] ======================================================================== malloc: free: SunOS: 0.00 0.00 2/6954557 _fclose [548] 0.00 0.00 28/6954557 _gethostbyname [404] 0.00 0.00 28/6954557 _xdr_bytes [607] 0.00 0.00 70/6954557 _freenode [637] 0.00 0.00 81/6954557 _morecore [338] 0.16 0.29 17715/6954557 _realloc [171] 2.74 5.06 306612/6954557 _shrink [205] 59.15 109.34 6630021/6954557 _Xfree [47] [46] 3.2 62.05 114.69 6954557 _free [46] 54.47 19.51 6954557/6954557 _insert [95] 21.47 19.24 5907584/6954542 _delete [111] ------------------------------------------------------------------------ GNU alpha: 0.00 0.00 2/7786430 _fclose [748] 0.00 0.00 28/7786430 _gethostbyname [427] 0.00 0.00 28/7786430 _xdr_bytes [627] 0.00 0.00 70/7786430 _freenode [631] 3.48 0.46 356188/7786430 _realloc [187] 72.57 9.54 7430114/7786430 _Xfree [80] [82] 1.6 76.05 10.00 7786430 _free [82] 9.41 0.00 8011082/13984534 .div [158] 0.01 0.58 992/10780 ___default_morecore [219] ------------------------------------------------------------------------ GNU emacs: 0.00 0.00 2/8153854 _fclose [494] 0.00 0.00 28/8153854 _gethostbyname [421] 0.00 0.00 28/8153854 _xdr_bytes [652] 0.00 0.00 70/8153854 _freenode [682] 0.94 0.00 271829/8153854 _realloc [221] 27.19 0.00 7881897/8153854 _Xfree [131] [135] 0.5 28.13 0.00 8153854 _free [135] ------------------------------------------------------------------------ Perl: 0.00 0.00 2/8192270 _fclose [514] 0.00 0.00 28/8192270 _gethostbyname [423] 0.00 0.00 28/8192270 _xdr_bytes [644] 0.00 0.00 70/8192270 _freenode [681] 0.95 0.00 366998/8192270 _realloc [196] 20.15 0.00 7825144/8192270 _Xfree [135] [145] 0.4 21.10 0.00 8192270 _free [145] ======================================================================== -- Kaleb Keithley Jet Propeller Labs kaleb@thyme.jpl.nasa.gov "So that's what an invisible barrier looks like!"