Fix quadratic behavior in the memory manager
authorLars Knoll <lars.knoll@digia.com>
Thu, 13 Dec 2012 22:46:51 +0000 (23:46 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Fri, 14 Dec 2012 08:09:55 +0000 (09:09 +0100)
commit21d90ca005700fe01bddda28b94db32421d59808
tree6dc30ff41bcab647e5835a4f539950159381d578
parent2761c4ceacab2e4f7da2e2a293a895595c02a928
Fix quadratic behavior in the memory manager

The old freeList implementation was causing quadratic
behavior in alloc(), as the free item ended up in the
highest chunk.

The new implementation uses a fixed size array for small objects
(up to 256 bytes), a QMap for large chunks, and a defaultFree
object pointing to the heap that has never been used before.

Gives around 25% performance boost on crypto.js, and bsaically
makes the memory manager invisible in kcachegrind.

Change-Id: I559fb527bcd9e21d4ac265f4d78b8376bfda2522
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qv4mm.cpp
qv4mm.h