Commit 2a941eeb authored by Benoît Lizé's avatar Benoît Lizé Committed by Commit Bot

base/allocator: Add multi-threaded PartitionAlloc perftests.

This adds very simple multi-threaded PartitionAlloc tests, by having a separate
thread repeatedly allocate and free from the same allocator as the main test
one.

This is not intended to be a rigorous and extensive performance test, but to
validate and evaluate options to make multi-threaded scenarios better in
PartitionAlloc. In particular, the output is very noisy, as it heavily depends
on scheduling decisions (as the spinlocks we use are not even remotely
fair/priority aware).

Example output on Linux, Xeon "Haswell" 2.6GHz:

[ RUN      ] MemoryAllocationPerfTest.SingleBucket
*RESULT MemoryAllocationPerfTest single bucket allocation (40 bytes): = 28790830 runs/s
*RESULT MemoryAllocationPerfTest single bucket allocation (40 bytes): = 34 ns/run
[       OK ] MemoryAllocationPerfTest.SingleBucket (2883 ms)
[ RUN      ] MemoryAllocationPerfTest.SingleBucketWithCompetingThread
*RESULT MemoryAllocationPerfTest single bucket allocation (40 bytes): = 97388 runs/s
*RESULT MemoryAllocationPerfTest single bucket allocation (40 bytes): = 10268 ns/run
[       OK ] MemoryAllocationPerfTest.SingleBucketWithCompetingThread (2239 ms)
[ RUN      ] MemoryAllocationPerfTest.SingleBucketWithFree
*RESULT MemoryAllocationPerfTest single bucket allocation + free (40 bytes): = 42599320 runs/s
*RESULT MemoryAllocationPerfTest single bucket allocation + free (40 bytes): = 23 ns/run
[       OK ] MemoryAllocationPerfTest.SingleBucketWithFree (2000 ms)
[ RUN      ] MemoryAllocationPerfTest.SingleBucketWithFreeWithCompetingThread
*RESULT MemoryAllocationPerfTest single bucket allocation + free (40 bytes): = 593330 runs/s
*RESULT MemoryAllocationPerfTest single bucket allocation + free (40 bytes): = 1685 ns/run
[       OK ] MemoryAllocationPerfTest.SingleBucketWithFreeWithCompetingThread (2529 ms)
[ RUN      ] MemoryAllocationPerfTest.MultiBucket
*RESULT MemoryAllocationPerfTest multi-bucket allocation: = 9683520 runs/s
*RESULT MemoryAllocationPerfTest multi-bucket allocation: = 103 ns/run
[       OK ] MemoryAllocationPerfTest.MultiBucket (4143 ms)
[ RUN      ] MemoryAllocationPerfTest.MultiBucketWithCompetingThread
*RESULT MemoryAllocationPerfTest multi-bucket allocation: = 250140 runs/s
*RESULT MemoryAllocationPerfTest multi-bucket allocation: = 3997 ns/run
[       OK ] MemoryAllocationPerfTest.MultiBucketWithCompetingThread (23626 ms)
[ RUN      ] MemoryAllocationPerfTest.MultiBucketWithFree
*RESULT MemoryAllocationPerfTest multi-bucket allocation + free: = 51287040 runs/s
*RESULT MemoryAllocationPerfTest multi-bucket allocation + free: = 19 ns/run
[       OK ] MemoryAllocationPerfTest.MultiBucketWithFree (2016 ms)
[ RUN      ] MemoryAllocationPerfTest.MultiBucketWithFreeWithCompetingThread
*RESULT MemoryAllocationPerfTest multi-bucket allocation + free: = 690414 runs/s
*RESULT MemoryAllocationPerfTest multi-bucket allocation + free: = 1448 ns/run
[       OK ] MemoryAllocationPerfTest.MultiBucketWithFreeWithCompetingThread (6374 ms)

The results with a competing thread are very unstable from run to run, but
always at least an order of magnitude worse than without a competing thread.

Bug: 998048
Change-Id: I086d5559e6fd6b10db61cf20d0f5df0e855020c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1859989Reviewed-by: default avatarChris Palmer <palmer@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706357}
parent 18064026
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment