RSoC Project: Ion as a library, week 2

By AdminXVII on

Keyword of the week: Error bubbling

Summary of the work done

Plan: Testing tendrils

Current state & the small string optimization (SSO)

Ion now uses small::String to store string data types. It’s an alternative String type that uses SSO to achieve better performance than the std one with typically small strings.

In Ion’s real world usage, strings tend to be fairly short (~ under 20 chars). The small string optimization is a technique where a string is a tagged union containing either a pointer to a heap string (like the one provided by the stdlib) or a stack-based array which is typically faster since it’s stored with the containing datastructure that’s already in a cache line. According to previous benchmarks, the switch to small strings gave Ion a 30% speed bump.

The alternative: tendrils

Tendril is an alternative “compact string/buffer type, optimized for zero-copy parsing”. It combines the small string and copy-on-write optimizations, possibly providing another performance boost. Further benchmarks will be needed.

What’s left to do