sugyan / atrium

Rust libraries for Bluesky's AT Protocol services.
MIT License
218 stars 26 forks source link

Replace OnceCell with static OnceLock for regex compilation #250

Closed itsfolf closed 1 week ago

itsfolf commented 1 week ago

The several Regex expressions used for validating types such as DateTime and DID are compiled individually during each deserialization. When profiling an application consuming thousands of events a second (firehose), these account for nearly 50% of CPU time.

sugyan commented 1 week ago

Thank you for the pull-request! It certainly seems to impact performance if it is run on many threads significantly.