Extend static B_int allocation to -128#2492
Conversation
Extended the B_int_strs cache to include pre-allocated B_int instances for negative integers from -1 to -128 (8-bit signed). This avoids dynamic allocation, and by extension the GC, with the aim of improving performance.
|
Perhaps the range -1 .. -128 is too broad as the most common negative number returned from C is -1 (like from str.c, net.c). @sydow what do you think? |
|
Python does down to -5 and up to 256 |
|
From what I remember, there was a reason why we didn't do any negative numbers at all and started from 0 instead, but I can't remember why... @sydow @nordlander whyyyy??? :) |
|
Sorry, no recollection… |
|
Compared to the static B_bool change, this is statistically insignificant. Marking as draft, should reduce the range to -5. |
|
I see no problems and Marko's PR looks perfect. I would recommend merging it as it is. |
but is this insignificant when you do |
Extended the B_int_strs cache to include pre-allocated B_int instances for negative integers from -1 to -128 (8-bit signed). This avoids dynamic allocation, and by extension the GC, with the aim of improving performance.