Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Shouldn't JSON be faster?

by jettero (Monsignor)
on May 31, 2010 at 00:27 UTC ( #842314=note: print w/ replies, xml ) Need Help??

in reply to Shouldn't JSON be faster?

Looks to me like most of what you're measuring is open() and flock(); Try the comparison again using strings in memory. Also, XS isn't necessarily faster. You're only going to notice huge speedups if the code you're doing in C has a *lot* to do before it hands it back to perl. If most of the code is handing things to perl, it may (probably not, but possibly) even slow it down compared to just doing things natively.

You may notice ad hoc parsing of short strings is faster in native perl and JSON::XS is only faster for large-ish js inputs. I suspect JSON::XS is usually faster though. It really depends how much parsing your ad hoc format requires.


Comment on Re: Shouldn't JSON be faster?
Replies are listed 'Best First'.
Re^2: Shouldn't JSON be faster?
by sflitman (Hermit) on May 31, 2010 at 06:46 UTC
    Thanks, I'll try doing it without file I/O

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://842314]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2016-05-27 03:43 GMT
Find Nodes?
    Voting Booth?