What's new?
Updated the snakecase algorithm optimizing the processing of strings that do not need to be modified. The changes yield the following results:
benchmark old ns/op new ns/op delta
BenchmarkUnchangedLong-8 95.2 37.6 -60.50%
BenchmarkUnchangedSimple-8 46.1 14.5 -68.55%
BenchmarkModifiedUnicode-8 36.4 41.4 +13.74%
BenchmarkModifiedLong-8 85.6 81.9 -4.32%
BenchmarkModifiedLongSpecialChars-8 128 127 -0.78%
BenchmarkModifiedSimple-8 42.3 45.0 +6.38%
BenchmarkModifiedUnicode2-8 71.7 79.4 +10.74%
BenchmarkLeadingUnderscoresDigitUpper-8 37.8 39.4 +4.23%
BenchmarkDigitUpper-8 33.4 28.9 -13.47%
BenchmarkDigitUpper2-8 83.5 84.8 +1.56%
benchmark old MB/s new MB/s speedup
BenchmarkUnchangedLong-8 346.67 878.58 2.53x
BenchmarkUnchangedSimple-8 238.83 757.91 3.17x
BenchmarkModifiedUnicode-8 247.09 217.28 0.88x
BenchmarkModifiedLong-8 338.64 354.06 1.05x
BenchmarkModifiedLongSpecialChars-8 233.89 234.43 1.00x
BenchmarkModifiedSimple-8 259.76 244.48 0.94x
BenchmarkModifiedUnicode2-8 362.85 327.45 0.90x
BenchmarkLeadingUnderscoresDigitUpper-8 158.70 152.21 0.96x
BenchmarkDigitUpper-8 149.82 172.80 1.15x
BenchmarkDigitUpper2-8 203.71 200.45 0.98x
benchmark old allocs new allocs delta
BenchmarkUnchangedLong-8 1 0 -100.00%
BenchmarkUnchangedSimple-8 1 0 -100.00%
BenchmarkModifiedUnicode-8 1 1 +0.00%
BenchmarkModifiedLong-8 1 1 +0.00%
BenchmarkModifiedLongSpecialChars-8 1 1 +0.00%
BenchmarkModifiedSimple-8 1 1 +0.00%
BenchmarkModifiedUnicode2-8 1 1 +0.00%
BenchmarkLeadingUnderscoresDigitUpper-8 1 1 +0.00%
BenchmarkDigitUpper-8 1 1 +0.00%
BenchmarkDigitUpper2-8 1 1 +0.00%
benchmark old bytes new bytes delta
BenchmarkUnchangedLong-8 48 0 -100.00%
BenchmarkUnchangedSimple-8 16 0 -100.00%
BenchmarkModifiedUnicode-8 3 3 +0.00%
BenchmarkModifiedLong-8 48 48 +0.00%
BenchmarkModifiedLongSpecialChars-8 32 32 +0.00%
BenchmarkModifiedSimple-8 16 16 +0.00%
BenchmarkModifiedUnicode2-8 3 3 +0.00%
BenchmarkLeadingUnderscoresDigitUpper-8 5 5 +0.00%
BenchmarkDigitUpper-8 5 5 +0.00%
BenchmarkDigitUpper2-8 32 32 +0.00%