StaticStrings v0.3.0
StaticStrings.jl v0.3 was just released and has joined the JuliaStrings Github organization. Special thanks to @PatrickHaecker for major contributions to this release.
StaticStrings.jl contains several string types which wrap a NTuple{N, UInt8} for strings of fixed length strings similar to InlineStrings.jl. The main difference is that StaticStrings.jl uses an NTuple whereas InlineStrings.jl uses integer types as a backing store.
Here are the release notes for version 0.3:
Release Notes
- Breaking changes for
CStaticString - Use of
unsafe_stringandunsafe_writefor performance - Deprecate
StaticStrings.datain favor ofTuple - Many contributions by @PatrickHaecker
Merged pull requests:
- fix: remove convert for AbstractStaticString{N} which causes invalidation (#21) (@Beforerr)
- Throw in
SubStaticStringconstructor without making it slower (#22) (@PatrickHaecker) - Implement a more efficient
codeunitforSubStaticString(#23) (@PatrickHaecker) - Allocation-free
writeandprintforPaddedStaticString(#24) (@PatrickHaecker) - Copy only relevant parts of a
SubStaticStringwhen generating aString(#25) (@PatrickHaecker) - Fix
cmp(#26) (@PatrickHaecker) - Avoid allocations in SubStaticString equality (#27) (@PatrickHaecker)
- Optimize
SubStaticStringby directly writing bytes (#28) (@PatrickHaecker) - Use the optimized
writeto optimizeprintforSubStaticString(#29) (@PatrickHaecker) - Unify
writeandprintmethods to have all types accelerated (#30) (@PatrickHaecker) - Restrict
SubStaticStringtoIntegerAbstractUnitRanges (#31) (@PatrickHaecker) - Make types consistent (#32) (@PatrickHaecker)
Closed issues:
- StaticStrings on GPU, code_warntype on StaticString generation (#20)
Upstream issue for JuliaLang/Julia
In reviewing Patrick’s work, I realized that Julia is missing facilities to populate a Vector{UInt8} or Memory{UInt8} from a NTuple{N,UInt8} efficiently. I created an issue documenting the lack of autovectorization for this route and potential new methods for copyto!.
Future Plans
- I was originally inspired to create this package to address fixed length strings coming from I/O libraries such as HDF5.jl. I never finished actually integrating this with I/O packages, so I hope to pursue that.
- I also noticed that an
AbstractStringthat wraps an existingMemory{UInt8}may be useful. I am unsure whether to add this to StaticStrings or if I should start a new package. - Your pull requests are welcome.