Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

First, whats meant by:

I ran into an issue that involved quite low-level transformations and as it turned out

To your comparison: The code sequence (*)

$string='7'; $num=$string+0
gives (*):
C:\>perl -MO=Concise,-exec -e"$string='7';$num=$string+0" 1 <0> enter 2 <;> nextstate(main 1 -e:1) v:{ 3 <$> const[PV "7"] s 4 <#> gvsv[*string] s 5 <2> sassign vKS/2 6 <;> nextstate(main 1 -e:1) v:{ 7 <#> gvsv[*string] s 8 <$> const[IV 0] s 9 <2> add[t4] sK/2 a <#> gvsv[*num] s b <2> sassign vKS/2 c <@> leave[1 ref] vKP/REFC

and the sequence (**)

$string='7'; $num=int($string)"

gives (**)

C:\>perl -MO=Concise,-exec -e"$string='7';$num=int($string)" 1 <0> enter 2 <;> nextstate(main 1 -e:1) v:{ 3 <$> const[PV "7"] s 4 <#> gvsv[*string] s 5 <2> sassign vKS/2 6 <;> nextstate(main 1 -e:1) v:{ 7 <#> gvsv[*string] s 8 <1> int[t4] sK/1 9 <#> gvsv[*num] s a <2> sassign vKS/2 b <@> leave[1 ref] vKP/REFC -e syntax OK
The Difference is (*)
8 <$> const[IV 0] s 9 <2> add[t4] sK/2
compared to (**)
8 <1> int[t4] sK/1

so there shouldn't be too much difference

Regards

mwa


In reply to Re: Converting a string to a real numeric value - what's faster? by mwah
in thread Converting a string to a real numeric value - what's faster? by isync

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-24 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found