Ruby 2.4.0 introduced String#unpack1
, which is faster than String#unpack[0]
#8
Labels
String#unpack1
, which is faster than String#unpack[0]
#8
We're probably not ready to end support for Ruby versions older than 2.4 (yet), but when we are, we could make methods for reading integers faster by switching to
String#unpack1
- see https://github.com/fastruby/fast-ruby#stringunpack1-vs-stringunpack0-code:According to the above benchmark,
String#unpack1
may be 29% faster.The text was updated successfully, but these errors were encountered: