Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^6: It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

by BrowserUk (Patriarch)
on Jul 15, 2018 at 21:08 UTC ( [id://1218519]=note: print w/replies, xml ) Need Help??


in reply to Re^5: It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?
in thread It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

Which is also why Perl 5 ithreads continue to have scalability issues for the past 15 years!

That statement is as wrong today, as the post you've attached it to was wrong, when you wrote it 15 years ago.

The only scalability issue with iThreads is the implementation (not the model) of shared memory aggregates.

Proof: The following simple demo code starts ARGV[0] threads that each lock/increment/release a shared scalar every 1/100th of second $ARGV[1] times:

#! perl -slw use threads stack_size => 4096; use threads::shared; $|++; sub usleep{ select'','','',$_[0] } my $count :shared = 0; sub doit{ do{ lock $count; printf "\r[%u] %u\t", threads->tid, ++$count; usl +eep 0.01 } for 1 .. $_[0]; } my @t = map threads->create( \&doit, $ARGV[1] // 300 ), 1 .. $ARGV[ 0 +]; $_->join for @t; print $count;

And a run:

C:\test>t-stress 3000 100 300000

That runs in a tad over 2GB, and once all 3000 threads are running -- a matter of a few seconds -- it consumes less that 1% cpu. That's as, if not more, scalable than any true (kernel) threading interpreted language as I know of, and better than many fully (native) compiled languages.

The fact that you wrote that despicable document without having the understanding to realise what a steaming pile it was, is lamentable.

The fact that 15 years on you haven't learnt enough to realise your mistake and are still promoting it; would be laughable if it wasn't so beyond the pale.

The fact that you are apparently designated (in large part) for specifying the multi-tasking in P6 -- despite being responsible for this other steaming pile of abandonware -- would be scary as well as irresponsible; were it not for the fact that P6 will never challenge even AppleScript or Logo for performance, and is thus useless for anything in the real world; so your brand of throw-in-everything-including-the-kitchen-sink programming will likely never be a serious bottleneck, cos no one will ever use it.


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". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit

Replies are listed 'Best First'.
Re^7: It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?
by liz (Monsignor) on Jul 15, 2018 at 21:55 UTC
    The only scalability issue with iThreads is the implementation (not the model) of shared memory aggregates.

    I'm glad to hear that Perl 5 users are now more interested in the theoretical benefits of Perl 5, rather than the practical ones.

    I suggest you try this benchmark by at least mimicking a real application, by e.g. adding a use Moose to your program. The problem with Perl 5 ithreads is not in tests like this. The problem is in real applications that set up a lot of data structures that need to be copied to all 3000 threads in your example. And whose memory will not be shared. I bet it will run a tad over 2 GB by just adding use Moose.

    The "steaming pile of abandonware", as you call it, contains forks, which will run your benchmark with use Moose in an acceptable time. And yes, all of my Perl 5 modules are up for adoption. I know some people are still using some of my modules in production, so I won't remove them from CPAN (just yet).

    As far as my article from 15 years ago being in error: The use of interpreter-based threads in perl is officially discouraged. What does that mean?

    From time to time, we may mark language constructs and features which we consider to have been mistakes as discouraged. Discouraged features aren't currently candidates for removal, but we may later deprecate them if they're found to stand in the way of a significant improvement to the Perl core.

    So, to me it seems that at least p5p has learned from its mistake. And that you haven't, I'm really sorry to say. For what it's worth, I would neither recommend Perl 5 ithreads, or the forks module at the current time: MCE - Many-Core Engine for Perl providing parallel processing capabilities seems to cover that niche in Perl 5 nicely. And then there's Mojolicious of course, if you'd like a more event driven approach.

    With regards to performance of Perl 6, let's say compared to Perl 5: I would say that at this point in time, Perl 6 is about 7x to 10x as slow as Perl 5. However, we have some very simple benchmarks where Perl 6 is clearly faster than Perl 5. And the number of these benchmarks is growing. To give an example: initializing an integer array with the first 5M positive integer values:

    $ time perl -e 'my @a = 0 .. 4_999_999' real 0m0.780s user 0m0.590s sys 0m0.184s $ time perl6 -e 'my int @a = 0 .. 4_999_999' real 0m0.466s user 0m0.485s sys 0m0.096s

    If we exclude the startup times (7 msecs / 146 msecs), then you could argue that Perl 6 is (780 - 7) / (466 - 146) = 2.415625x as fast as Perl 5. Even with the startup times disregarded, it's still 780 / 466 = 1.67382x faster as Perl 5 (for this benchmark).

    And by the way, I think the term "steaming pile of abandonware" is uncalled for, and I would like you to apologize for that.

    EDIT: changed ^5_000_000 to the equivalent 0 .. 4_999_999 as to avoid confusion.

      > The use of interpreter-based threads in perl is officially discouraged

      It's not so easy.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Indeed, it is not so easy. Still I think there would be a good chance of salvaging the threads API by ditching the current Perl 5 ithreads implementation and spending (I think a relative small effort) to make forks core and rename it to "threads". And you wouldn't even have to build your perl with -Dmultiplicity, because forks supports this out of the box.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-19 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found