Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Using CORE:: with autobox

by ferreira (Chaplain)
on Feb 19, 2007 at 19:27 UTC ( #600930=note: print w/replies, xml ) Need Help??


in reply to Using CORE:: with autobox

I don't know the source code of autobox, but as it is a non-standard module, things like $s.uc will probably be slower than uc $s always. But if the additional overhead comes from subroutine call, you can try something like:

BEGIN { *SCALAR::uc = \&CORE::uc }
instead of
sub SCALAR::uc { CORE::uc($_[0]); }
or the optimized
sub SCALAR::uc { goto &CORE::uc; }

(The BEGIN is important here to make it behave as a compile-time function declaration.)

If it works, you will have less one frame in the call stack, which may or may not speed things up. This suggestion is untested and may not work: There is some weirdness associated to the core functions that don't behave identically to the ordinary subs.

Replies are listed 'Best First'.
Re^2: Using CORE:: with autobox
by diotalevi (Canon) on Feb 19, 2007 at 21:46 UTC

    You can't take references to CORE:: functions and goto() is slower than just leaving the call frame on the stack.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2019-10-14 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?