limit - 512

Stephen Weeks MLton@sourcelight.com
Wed, 9 Aug 2000 20:11:19 -0700 (PDT)


> Stupid  optimization  hacks: Instead of keeping the limit in a register, keep
> limit - 512 in a register.  Now, when ever you are going to do a check to see
> if  there  is  enough  space,  if  you want 512 bytes or less, just check the
> frontier against the limit - 512.  This might  cause  you  to  GC  512  bytes
> early, but who cares.  A stupid hack, but perhaps worth while.

Here is the distribution of limit check sizes for a recent self compile.  From
this, it looks like the hack is well worth it, and a reasonable cutoff is 256 or
512.

      # size
   ---- ----
    915	variable
   1160	0
    443	8
   2660	12
   1035	16
    197	20
   1372	24
    380	28
    298	32
    675	36
    281	40
    138	44
    352	48
    167	52
     81	56
    150	60
    106	64
    115	68
    114	72
     90	76
     69	80
     83	84
     75	88
     30	92
     36	96
     33	100
     20	104
     39	108
     40	112
     18	116
     47	120
     24	124
     10	128
     15	132
     13	136
     12	140
     70	144
      9	148
     26	152
      9	156
      9	160
      8	164
      7	168
      1	172
      6	176
      1	180
      7	184
      6	188
      3	192
      3	196
      2	200
      1	204
      2	208
      3	212
      3	216
      1	220
      2	224
      4	228
      1	232
      1	236
      2	240
      3	244
      1	248
      2	252
      1	256
      1	268
      1	284
      3	292
      1	296
      1	300
      1	308
      2	312
      1	324
      1	332
      1	336
      2	344
      1	360
      1	364
      1	384
      1	420
      1	436
      1	440
      1	452
      1	484
      1	568
      1	640
      2	652
      1	696
      1	716
      2	760
      1	960
      2	1036
      1	1276
      1	1296
      1	1376
      1	1528
      1	1576
      1	3484
      1	28456