Skip to content

Conversation

@parsonsmatt
Copy link

@parsonsmatt parsonsmatt commented Jun 24, 2025

This PR switches the Vector metric away from IORef (Map k v) to StmContainers.Map k v`, significantly improving performance in concurrent modification.

This is a breaking change with very slight impact: the constraint Hashable is added to two functiosn which previously got by on mere Label. Since Label appears to mostly be useful for tuples of texts, this should not break most use sites.

I created benchmarks on my other fork with other memory improvements: parsonsmatt#1 stm-containers is faster with two threads and up; with high contention and lots of concurrent modification (as we expect to see in a webserver), stm-containers levels out while IORef (Map k v) runs into massive concurrency contention.

In the other PR, I left the old implementation, and switched the default. In this PR I've simply used the faster implementation. I don't think the meager performance benefit in single threaded applications is worth complicating the code in library.

This is also a fix to #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant