Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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 avoiding work at the Monastery: (12)
As of 2015-11-30 18:06 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (778 votes), past polls