Here a difference:
Add a tiny optimization.
Do you have some benchmarks or test case that show results of the optimisation?
I did something similar in https://github.com/mabrek/epgsql/blob/async/src/pgsql_wire.erl#L39 , but didn't compare decoding speed because it wasn't a bottleneck in my case.
It was something like 32% of the execution time was in the decode_stringfunction.
My code decreased it to 28%. Not so much.
I did not tested the code with binary:split, but it can be even more slow. :/
Use functions from the binary module.