mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Add a braindead 10x speedup to kmalloc().
Skip over entirely full buckets when scanning for a big-enough memory slot. This means I can postpone writing a better kmalloc() for a while longer! :^)
This commit is contained in:
parent
dea474dfd5
commit
5e8e554f94
1 changed files with 6 additions and 0 deletions
|
@ -112,6 +112,12 @@ void* kmalloc(dword size)
|
|||
|
||||
for( i = 0; i < (POOL_SIZE / CHUNK_SIZE / 8); ++i )
|
||||
{
|
||||
if (alloc_map[i] == 0xff) {
|
||||
// Skip over completely full bucket.
|
||||
chunks_here = 0;
|
||||
continue;
|
||||
}
|
||||
// FIXME: This scan can be optimized further with LZCNT.
|
||||
for( j = 0; j < 8; ++j )
|
||||
{
|
||||
if( !(alloc_map[i] & (1<<j)) )
|
||||
|
|
Loading…
Add table
Reference in a new issue