Difference between ShortStrings.jl and InlineStrings.jl

They look similar. What is the difference - when do I want each?

1 Like

I think InlineStrings can be seen as a sort of successor to ShortStrings, so you should probably be using that. It’s also the package that’s directly tied into CSV.jl, and there are plans for wider integration with the data ecosystem (eg Arrow.jl)

In addition to @nilshg response, which is accurate, I can provide a little context. While both packages provide similar functionality (support for fixed-width, non-heap strings), ShortStrings.jl is much older and is more of a product of the time when it was implemented.

While digging into ShortStrings.jl, I realized there were a number of advances in the Julia language that would allow a simpler, more efficient, and more thorough implementation, while also avoiding almost all external dependencies. InlineStrings.jl uses a novel (and very cool/fun IMO) approach by defining native primitive type InlineString256 2048 end, and then using native LLVM intrinsics to do bit operations to do string manipulations, which amazingly even work on these “integers” of size up to 2048 bits!

Anyway, all that to say that sometimes there is such a significantly different implementation in mind, that I believe it’s worth just “starting over” from scratch and seeing what a clean implementation can produce.