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 = 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);
|
||||
} else {
|
||||
// The common case, and also the simplest. This just pops the
|
||||
|
|
Loading…
Reference in New Issue