diff options
author | Loïc Hoguin <[email protected]> | 2024-07-02 12:07:50 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2024-07-02 17:26:33 +0200 |
commit | cdaac4c907dbee90a91ad123b18dc6919a3835f6 (patch) | |
tree | 7d2ab8b2114cf6b4fa079c8c388fa34f1150b33e /doc/src | |
parent | 941d408ea40022da3148b5b96483d5e8f95caaa4 (diff) | |
download | cowlib-cdaac4c907dbee90a91ad123b18dc6919a3835f6.tar.gz cowlib-cdaac4c907dbee90a91ad123b18dc6919a3835f6.tar.bz2 cowlib-cdaac4c907dbee90a91ad123b18dc6919a3835f6.zip |
Optimise cow_uri:urldecode
The recently added `json` module in OTP demonstrated
new, better ways of optimising binary string manipulations.
Some of which likely make better use of recent compiler
or VM improvements.
The main improvement is returning as fast as possible
when there's nothing to decode:
cow_uri:urldecode in 0.053833s
cow_uri:urldecode in 0.005991s
When there's a little to decode, the performance is
nicely improved, although not as much:
cow_uri:urldecode_hex in 0.061018s
cow_uri:urldecode_hex in 0.040028s
When the input if fully/mostly encoded JP text, the
difference is remarkable:
cow_uri:urldecode_jp_hex in 0.099333s
cow_uri:urldecode_jp_hex in 0.039391s
cow_uri:urldecode_jp_mixed_hex in 0.097653s
cow_uri:urldecode_jp_mixed_hex in 0.046385s
The worst case scenario unfortunately is slower than
before, but nothing too bad. The worst case is when
the input is a sequence of 3 encoded characters
followed by 3 non-encoded characters:
cow_uri:urldecode_worst_case_hex in 0.050017s
cow_uri:urldecode_worst_case_hex in 0.061515s
Diffstat (limited to 'doc/src')
0 files changed, 0 insertions, 0 deletions