[Bug libstdc++/96942] std::pmr::monotonic_buffer_resource causes CPU cache misses
dmitriy.ovdienko at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Sep 7 20:53:42 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96942
--- Comment #7 from Dmitriy Ovdienko <dmitriy.ovdienko at gmail dot com> ---
Following are CPU counters for single threaded code. Pre-allocation is enabled.
Memory pool is created inside the loop.
```cpp
int poolSize(int depth)
{
return (1 << (depth + 1)) * sizeof(Node);
}
int count = 0;
for(int i = 0; i < 20; ++i)
{
MemoryPool store (poolSize(stretch_depth));
Node *c = make(stretch_depth, store);
count += c->check();
store.release();
}
```
Depth = 21, Pool size = 134,217,728 Bytes
| | PMR | Malloc |
|-------------------|----------------|---------------|
| cache-references | 60,180,483 | 60,205,187 |
| cache-misses | 50,288,765 | 50,426,418 |
| cycles | 7,587,314,879 | 6,076,106,356 |
| instructions | 14,347,088,112 | 8,138,591,245 |
| branches | 2,224,641,671 | 1,550,701,277 |
| branch-misses | 8,074,211 | 7,307,996 |
| faults | 655,503 | 655,485 |
| migrations | 1 | 2 |
| time elapsed, sec | 2.16 | 1.75 |
| time (user, sec) | 1.46 | 1.01 |
| time (sys, sec) | 0.69 | 0.73 |
Depth = 18, Pool size = 16,777,216 Bytes
| | PMR | Malloc |
|-------------------|---------------|-------------|
| cache-references | 8,186,788 | 3,450,642 |
| cache-misses | 6,504,691 | 1,592,945 |
| cycles | 992,526,559 | 472,979,689 |
| instructions | 1,806,230,679 | 766,527,818 |
| branches | 279,352,274 | 151,353,530 |
| branch-misses | 1,072,404 | 474,648 |
| faults | 82,063 | 8,314 |
| migrations | 0 | 0 |
| time elapsed, sec | 0.28 | 0.14 |
| time (user, sec) | 0.17 | 0.13 |
| time (sys, sec) | 0.11 | 0.01 |
Depth = 17, Pool size: 8,388,608 Bytes
| | PMR | Malloc |
|-------------------|-------------|-------------|
| cache-references | 1,624,992 | 1,707,061 |
| cache-misses | 867,310 | 718,011 |
| cycles | 312,687,116 | 255,951,365 |
| instructions | 765,410,795 | 389,671,180 |
| branches | 118,619,222 | 74,686,565 |
| branch-misses | 272,286 | 263,916 |
| faults | 4,221 | 4,219 |
| migrations | 0 | 0 |
| time elapsed, sec | 0.10 | 0.08 |
| time (user, sec) | 0.10 | 0.07 |
| time (sys, sec) | 0.00 | 0.01 |
More information about the Gcc-bugs
mailing list