Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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.


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]
[marioroy]: Well, that's why there must be angels around, invisible or not.
[marioroy]: Lady_Aleena yes, ladder.
[marioroy]: Corion, no not intentionally. not at all.
[Lady_Aleena]: /ne tries to decide whther or not to take a hammer to hubby's alarm clock.
[Lady_Aleena]: He never hears it.
[marioroy]: Back in HighSchool, I came late to Gym class. There was a fellow who was picked last, no team wanted him for racketball. So it was us two against everybody. I looked at him in the eye and said to let your body loose and let the powers to be help us win.
[marioroy]: We made it all the way to the end. The expience was magical. I not good at sports. Someone or thing was there.
erix considers extracting a catalog ...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2017-05-29 08:41 GMT
Find Nodes?
    Voting Booth?