mirror of
https://github.com/gperftools/gperftools
synced 2025-02-18 05:06:55 +00:00
inform compiler that tcmalloc allocation sampling is unlikely
Now compiler generates slightly better code which produces jump-less code for common case of not sampling allocations.
This commit is contained in:
parent
4f051fddcd
commit
bce72dda07
@ -1091,7 +1091,7 @@ inline void* do_malloc_small(ThreadCache* heap, size_t size) {
|
|||||||
size_t cl = Static::sizemap()->SizeClass(size);
|
size_t cl = Static::sizemap()->SizeClass(size);
|
||||||
size = Static::sizemap()->class_to_size(cl);
|
size = Static::sizemap()->class_to_size(cl);
|
||||||
|
|
||||||
if ((FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
|
if (UNLIKELY(FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
|
||||||
return DoSampledAllocation(size);
|
return DoSampledAllocation(size);
|
||||||
} else {
|
} else {
|
||||||
// The common case, and also the simplest. This just pops the
|
// The common case, and also the simplest. This just pops the
|
||||||
|
Loading…
Reference in New Issue
Block a user