Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi all, I test on same machine with lastest version of perl and python

Perl version:v5.32.0
Python version:3.8.5
I have a little disappoint about the result:
Perl slower a lot than python.
weizhong@weizhong-VirtualBox:~/Git/compare-pdl_numpy$ ./compare.csh

Python test1.py:
0.5u 1.0s 0:01.84 88.0% 0+0k 0+0io 0pf+0w

Perl test1.pl:
1.2u 2.0s 0:05.83 55.5% 0+0k 19064+0io 907pf+0w

Python test1.py:
0.7u 0.7s 0:02.54 60.2% 0+0k 52008+0io 141pf+0w

Perl test1.pl:
1.3u 1.9s 0:05.28 61.3% 0+0k 30432+0io 1005pf+0w

Perl Code(test1.pl):
#!/home/weizhong/tools/perl-5.32.0/perl use PDL; $PDL::BIGPDL = 1; $X = zeroes(1000,500,500); $Y = ones(1000,500,500); $Z1 = $X + $Y; $Z2 = $X / $Y;
Python Code(test1.py):
#!/home/weizhong/tools/Python-3.8.5/python import numpy as np X = np.zeros((1000,500,500)) Y = np.ones((1000,500,500)) Z1 = X+Y Z2 = X/Y
compare.csh:

#!/bin/csh -f echo "Python test1.py:"; time ./test1.py echo "Perl test1.pl:"; time ./test1.pl echo "Python test1.py:"; time ./test1.py echo "Perl test1.pl:"; time ./test1.pl

In reply to Perl PDL slower than python numpy by fanasy

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (7)
    As of 2021-03-03 17:22 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favorite kind of desktop background is:











      Results (83 votes). Check out past polls.

      Notices?