Closed glaszig closed 5 years ago
LGTM, @jch ?
Wow, this is great. Sorry for the late response, I was out on vacation in the woods. I'll queue this up for some testing.
any issue with this? can we get this off our plates?
Sorry, work's been busy, so still haven't had time to properly test this on a live production app.
rebased onto master. on a newer macbook (2015, the results above are from a mbp 2010), this patch is still orders of magnitude faster. lgtfm?
Rehearsal -------------------------------------------------
interpolation 3.069502 0.002232 3.071734 ( 3.073401)
String#unpack 0.054645 0.000613 0.055258 ( 0.055467)
---------------------------------------- total: 3.126992sec
user system total real
interpolation 3.036294 0.001228 3.037522 ( 3.038139)
String#unpack 0.053609 0.000240 0.053849 ( 0.053939)
input: https://www.example.com/path/to/image.png
interpolation: 68747470733a2f2f7777772e6578616d706c652e636f6d2f706174682f746f2f696d6167652e706e67
String#unpack: 68747470733a2f2f7777772e6578616d706c652e636f6d2f706174682f746f2f696d6167652e706e67
Can't argue with numbers, thanks. Bumping this out as 2.11 now.
ruby's benchmark with 100_000 iterations report some performance improvement (up to 80x on my machine) over iterating over each byte.
https://gist.github.com/glaszig/9d1975b1821a799c5db5957c4cff1539