4 ms·
I just did a followup test to see just how the re:replace function did with converting a 16kb text string with a BBCode parser I've written in Erlang, and on my
by chops 16y ago
I just did a followup test to see just how the re:replace function did with converting a 16kb text string with a BBCode parser I've written in Erlang, and on my crappy laptop it did 1000 conversions in 12 seconds. Further, I'm not running the high-performance version of Erlang, nor did I do any attempts at parallelization optimization.
Surprising to me was that the performance difference between binaries and strings wasn't too much different.
Module: https://github.com/choptastic/Yabbie/blob/linux/site/src/lib/bbcode.erl https://github.com/choptastic/Yabbie/blob/linux/site/src/lib...
(keep in mind, this is built with the Nitrogen Web Framework in mind, so if you want to run it stand-alone, you can comment out the include lines and it should work just fine).
(nitrogen@127.0.0.1)9> bbcode:benchmark("l4d.txt",1000).
[{binary_time,12841.423},{string_time,12888.905}]
So 12000 milliseconds for 1000 iterations each. A few millisecond difference (46 millisecond difference) isn't much of a difference.
- silentbicycle 16y agoThat measurement would probably be more useful if stacked against same in Java / Python / Ruby / etc. Writing the parser itself in Erlang seems expensive; passing text through discount (http://www.pell.portland.or.us/~orc/Code/discount/ http://www.pell.portland.or.us/~orc/Code/discount/) in an otherwise Erlang system seems like a good neutral measure. (and then 100k threads doing same concurrently)
- chops 16y agoAbsolutely. Perhaps I'll do a more elaborate comparison between a few other languages just to see.