I started playing with Ryan's tnetstrings and it looks like it performs a lot worse than my naive implementation. What I did is made basic types work (null, bool, numbers, strings) and then wrote a couple of similar unit tests that only encode those elements. Here's ryan's run with 100 million encodes: real 1m35.930s user 1m29.640s sys 0m0.000s And here's my code with the same: real 6m45.880s user 6m12.120s sys 0m0.000s So Ryan's beats the pants off mine. I'll be working this into mongrel2 and then using it from now on. Thanks Ryan! Zed
On Fri, 2011-03-25 at 18:29 -0700, Zed A. Shaw wrote: > I started playing with Ryan's tnetstrings and it looks like it performs > a lot worse than my naive implementation. You had me worried there for a second... > Here's ryan's run with 100 million encodes: > > real 1m35.930s > user 1m29.640s > sys 0m0.000s > > And here's my code with the same: > > real 6m45.880s > user 6m12.120s > sys 0m0.000s > > So Ryan's beats the pants off mine. Phew! :-) Thanks for a fun little challenge. I'm going to play with the native python implementation some more, see I can't borrow a few tricks from the C version to speed it up a little. Cheers, Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digitally signed. Please visit ryan@rfk.id.au | http://www.rfk.id.au/ramblings/gpg/ for details
On Sat, Mar 26, 2011 at 12:41:44PM +1100, Ryan Kelly wrote: > On Fri, 2011-03-25 at 18:29 -0700, Zed A. Shaw wrote: > > I started playing with Ryan's tnetstrings and it looks like it performs > > a lot worse than my naive implementation. Oh yeah I forgot to continue that story. It looked like that yours was worse than mine, but then I realized I was using debug() logging in the damn loop, which, ehem, makes the numbers way off. Removing the debug and it was correct. -- Zed A. Shaw http://zedshaw.com/