Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^3: Can someone please write a *working* JSON module

by Fletch (Bishop)
on Oct 24, 2021 at 17:53 UTC ( #11137979=note: print w/replies, xml ) Need Help??

in reply to Re^2: Can someone please write a *working* JSON module
in thread Can someone please write a *working* JSON module

I'm the one pointing out that you're making a wild assertion (paraphrasing, "BLOCK eval causes an order of magnitude(s) slowdown") which runs counter to consensus experience without giving any concrete evidence or providing any sample code which evidences the problem in question by myself providing a counter example, yes.

Show us code which evidences this purported order of magnitude(s) slowdown and I bet you'll get a reply from someone either pointing out what you're doing wrong, or if it's actually something you'll have eyes look at it from someone quite likely to be able to fix the problem in perl itself. BLOCK eval does add a small overhead because of the extra steps involved, but not that much (it's a couple of extra opcodes in the tree that don't really do much of anything if no exception occurs).

Or keep whinging about downvotes because you posted something detail- and code-free that (observationally) most people reading think is bunk. Tomayto, tomahto.

Edit: Tested the same benchmarks with a 700+k character "NON-TRIVIAL" chunk of both valid and invalid JSON (the later made by substituting in random garbage somewhere in the former). Aside from the processing rate understandably going down with the larger amount to parse the results look similar showing that the presence or absence of eval has no measurable effect (hundreds/sec for the non-PP versions versus 30k/sec; PP gets on the order of 1/sec eval or no).

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^4: Can someone please write a *working* JSON module (modperl sideeffects)
by LanX (Sage) on Oct 24, 2021 at 18:11 UTC
    > a wild assertion (paraphrasing, "BLOCK eval causes an order of magnitude(s) slowdown") which runs counter to consensus experience

    My guess:

    The OP was highlighting a modperl environment, which is notorious for global side effects IIRC.

    So if one of the other modperl clients is manipulating the error mechanism, (like setting $SIG{WARN} or CGI::Carp or something homebrewn), this could lead to some slowdown.(Disclaimer: I never tried this, especially never tried modperl)

    It's hard to tell why this is triggered by eval {BLOCK} , but this could be connected to ignoring that special variable which indicates the handler was fired inside an eval. (See $^S in perlvar )

    All of this is of course not related to JSON ... and switching to another technology like fastcgi or PSGI should fix it.

    Tho I wouldn't be surprised if the OP fiddled with error handlers by himself without taking care of $^S

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2023-01-31 20:26 GMT
Find Nodes?
    Voting Booth?

    No recent polls found