in reply to Shouldn't JSON be faster?

I think you're doing apples and oranges and most of the time is in the file stuff. You will get a decent boost if you drop the OO interface and copying the hash.

# decode_json($json); Rate load_config load_json load_config 13.8/s -- -79% load_json 66.1/s 380% --

Replies are listed 'Best First'.
Re^2: Shouldn't JSON be faster?
by sflitman (Hermit) on May 31, 2010 at 06:53 UTC
    That's interesting, I was able to show the same benefit. Why is OO interface slow?

    SSF

      OO uses methods instead of straight subs/functions and they (in the past at least) introduce an overhead of like 30%. OO is fantastic where appropriate but for stuff like this I think the functional interface is better.

      What are you talking about? load_json is faster than load_config, and load_json is the only OO code shown