[PATCH] D31989: Avoid calling SizeClassMap::MaxCachedHint on hot path, it's not free.

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 12:01:16 PDT 2017


alekseyshl created this revision.
Herald added a subscriber: kubamracek.

Remove unecessary SizeClassMap::MaxCachedHint call.


https://reviews.llvm.org/D31989

Files:
  lib/sanitizer_common/sanitizer_allocator_local_cache.h


Index: lib/sanitizer_common/sanitizer_allocator_local_cache.h
===================================================================
--- lib/sanitizer_common/sanitizer_allocator_local_cache.h
+++ lib/sanitizer_common/sanitizer_allocator_local_cache.h
@@ -102,7 +102,7 @@
   NOINLINE void Refill(PerClass *c, SizeClassAllocator *allocator,
                        uptr class_id) {
     InitCache();
-    uptr num_requested_chunks = SizeClassMap::MaxCachedHint(class_id);
+    uptr num_requested_chunks = c->max_count / 2;
     allocator->GetFromAllocator(&stats_, class_id, c->chunks,
                                 num_requested_chunks);
     c->count = num_requested_chunks;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31989.95014.patch
Type: text/x-patch
Size: 675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/a208cb07/attachment.bin>


More information about the llvm-commits mailing list