Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^6: printing every 2nd entry in a list backwards

by vrk (Chaplain)
on May 19, 2017 at 14:04 UTC ( #1190619=note: print w/replies, xml ) Need Help??


in reply to Re^5: printing every 2nd entry in a list backwards
in thread printing every 2nd entry in a list backwards

I just tried it on my laptop:

$ python --version Python 2.7.12 $ time python every-second-item-reversed.py in.txt > pyout.txt real 0m1.927s user 0m1.898s sys 0m0.028s
$ perl -v This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-li +nux-thread-multi [...] $ time perl every-second-item-reversed-haukex.py in.txt > haukex-out.t +xt real 0m2.309s user 0m2.290s sys 0m0.020s

No differences in the two output files. However, note Perl 5.24.1 is faster than both Python 2.7.12 and Perl 5.18.1:

$ perl5.24.1 -v This is perl 5, version 24, subversion 1 (v5.24.1) built for x86_64-li +nux-thread-multi [...] $ time perl5.24.1 every-second-item-reversed-haukex.py in.txt > haukex +-out-5.24.1.txt real 0m1.759s user 0m1.740s sys 0m0.016s

And also Python 3.4 is slower than any of the above:

$ python3.4 --version Python 3.4.5 $ time python3.4 every-second-item-reversed.py in.txt > pyout-3.4.txt real 0m2.493s user 0m2.444s sys 0m0.048s

Replies are listed 'Best First'.
Re^7: printing every 2nd entry in a list backwards
by haukex (Prior) on May 19, 2017 at 14:13 UTC

    Good point! In my test above I was pitting Python 2.7.6 against Perl 5.22.0. I can confirm that both Perl 5.18.2. and Python 3.4.3 are slower by a factor of roughly 1.3 to 1.4 on my machine (those are just the versions I have lying around at the moment).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1190619]
help
Chatterbox?
Discipulus here..
[marto]: "what is normal or expected in any given circumstances."
[marto]: better: "If a type of behaviour, event, or situation is par for the course, it is not good but it is normal or as you would expect"
[Discipulus]: thanks i was unable to decide where to split the sentece
[marto]: FWIW search.cpan rarely has issues, see http://noc.perl. org for a route to report problems
[oakbox]: thanks, marto.
[marto]: there was a period where search.cpan had some frequent outages for (IIRC) a couple of weeks. I've not had any problems since, until today.
[marto]: this was about 16 months ago maybe. the noc team are, in my experience, very responsive to reports of issues, so please raise the issue after checking known problems/outages

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2017-07-26 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (388 votes). Check out past polls.