I do not know what causes this slowdown, and I did not expect it either. Allocating and releasing memory should require (roughly) the same amount of time, regardless of the size of the allocation (as long as it can be covered by the allocator's page size). There must be more to that.
@utri007 How much slower is it?
There is plenty of room for "tuning" the new memory management. Tuning requires that data is collected on how the memory management is used, for later analysis. To this end there is an interface in the clib2 runtime library which NetSurf uses. It would be nice to allow for memory usage information to be collected through that interface, to be stored in log files.
You can send SLABSTATS to NetSurf's ARexx port to get it to dump them to the log.
NetSurf -V ram:ns.log
rx "address netsurf 'slabstats'"
I did find with the log enabled NetSurf was crashing, but I don't think that's related to the stats collection. I might see about modifying this so the stats are stored in an ARexx stem variable.
This isn't in the 3.6 build as I added it later, I'll need to upload a new test version but I can't do that today.
I did notice that we get thousands of allocations of 32 bytes, and not much above 2K. I reduced the slab size to 2K (again, after this 3.6 build) and the timings don't look much different. v3.6 has the slab set at 8K.