fast_allocator.c: optimize for the region with single allocator
parent
55f1e139a9
commit
8717f85608
|
|
@ -167,6 +167,15 @@ static int region_init(struct fast_allocator_context *acontext,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (region->count == 1) {
|
||||||
|
if (region->start == 0) {
|
||||||
|
region->step += sizeof(struct allocator_wrapper);
|
||||||
|
} else {
|
||||||
|
region->start += sizeof(struct allocator_wrapper);
|
||||||
|
}
|
||||||
|
region->end += sizeof(struct allocator_wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
name = name_buff;
|
name = name_buff;
|
||||||
result = 0;
|
result = 0;
|
||||||
allocator = region->allocators;
|
allocator = region->allocators;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include "fastcommon/array_allocator.h"
|
#include "fastcommon/array_allocator.h"
|
||||||
#include "fastcommon/sorted_array.h"
|
#include "fastcommon/sorted_array.h"
|
||||||
|
|
||||||
#define ELEMENT_COUNT 5 * 1000
|
#define ELEMENT_COUNT 1000
|
||||||
|
|
||||||
static bool silence;
|
static bool silence;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue