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

Re^2: parallelism v.python

by BrowserUk (Patriarch)
on Feb 28, 2014 at 22:09 UTC ( [id://1076624]=note: print w/replies, xml ) Need Help??


in reply to Re: parallelism v.python
in thread parallelism v.python

Perhaps this is (part of) the cause?

CPython implementation detail: In CPython, due to the Global Interpreter Lock, only one thread can execute Python code at once

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^3: parallelism v.python
by perl-diddler (Chaplain) on Feb 28, 2014 at 23:54 UTC
    Holy batpoo! Yeah, that might explain a bit...
Re^3: parallelism v.python
by perl-diddler (Chaplain) on Mar 12, 2014 at 01:38 UTC
    BTW, been thinking about this a bit...

    If it was just a matter of parallelism V non-parallelism, that would be 1 issue.

    But the 2nd big issue: Look at the total cpu time used:

    lang #thrds #cores_used %efficency clocktime cputime(Usr+Sy +s) python 9 1.82 20.2% 67.35s 122.53s perl 9 8.70 96.7% 3.36s 29.23
    From the above, stated as percentages or multipliers, perl is 478% more efficient in making use of multicore resources.

    In real time, python takes 64 seconds longer over the base time that was needed, of 3.36s. Python is 1900% SLOWER.

    Someone mentioned python might not be optimal in parallelism due to threading problems.

    So look at the actual amount of CPUtime used for each to do the work. 122.53/29.23. For heavy number crunching, perl (with max precision possible in x86-64 HW, takes less than 1/4th the time, i.e. perl is 4.2x the speed of python.
    ----

    (Notes collected for a response to the "said" note writer...)

      Yup. https://wiki.python.org/moin/Concurrency/ applies. In short: Don't use threading on CPython unless you have to.

      Also for multiline prints, you can either wrap in brackets, use triple quotes, or use \ line continuance.

      ...and some say that Python has only one way of doing things... ;-)

        > ...and some say that Python has only one way of doing things... ;-)

        oh ... they do!

        "There's Only One Way To Do It"

        This was the slogan PythonLabs came up with for the T-shirts given away by the defunct BeOpen at OSCON 2000. It was meant as a tongue-in-cheek response to Larry Wall's Perl slogan "There's more than one way to do it." but the community liked it and it has often been taken very seriously in language or library design discussions. The Zen of Python is more nuanced:

        There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch.

        see also One people, one language, one dictator! :)

        Cheers Rolf

        ( addicted to the Perl Programming Language)

      What processor was this run on? (Can I safely assume that you were running in a non-VM environment?)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Oops, sorry, missed your Q earlier.

        Two socket, 6-core X5660 Xeon @ 2.80GHz.

        I don't know about 'safe' assumptions, but in this case, such an assumption would be correct -- er.. wait, what's a VM again? ;-)

        I am running a numa-aware kernel, w/default policies, V3.13.5, SMP PREEMPT, 1000Hz clock interrupt in 'tickless mode'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-23 06:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found