Skip to content

[C++] Investigate using std::memory_order in MemoryPoolStats to improve performance #40646

@amoeba

Description

@amoeba

Describe the enhancement requested

MemoryPoolStats keeps track of stats (bytes_allocated, max_memory, total_allocated_bytes, num_allocs) which are useful in a variety of contexts. The current implementation doesn't take advantage of functionality in std::memory (See Release-Acquire Ordering) which may improve performance for some types of applications on certain kinds of hardware.

For example, max_memory is monotonically increasing so it can use a relaxed load which is essentially free on x86.

I don't have an example which shows the current performance impact and automated benchmarking like in ddfa8ee doesn't exercise the right workload to show it so any ideas would be welcome.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions