streambed / streambed-rs

Event driven services toolkit
Apache License 2.0
31 stars 5 forks source link

Change Topic to SmolStr #47

Closed huntc closed 11 months ago

huntc commented 11 months ago

By changing a topic to a SmolStr we get a 5% and 12% improvement on performance for producing to a topic and consuming from a topic respectively.

I think that a significant amount of performance comes from SmolStr representing strings that are immutable and are therefore shared with an Arc. Thus, cloning is cheap. We might be able to squeeze more performance by reducing our strings in general given a length sub 25 bytes, and do this by separating a namespace out into its own field i.e. make Topic a struct with namespace and name fields. I'm not convinced that it'd be worth it though.

I've also updated some dependencies to bring things up to date.