Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^5: 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 15:13 UTC ( [id://1218511]=note: print w/replies, xml ) Need Help??


in reply to Re^4: 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?

But Perl 6 has the Native Calling Interface which allows you to "Call into dynamic libraries that follow the C calling convention". This means that if you're using XS for accessing external libraries, you won't have to use XS. Which I think a lot of people would see as a plus. For example, this is the code to interface with the C-function ctime:
use NativeCall; sub the-time(Int() $it = time) { # coerce to Int, cu +rrent time default sub ctime(int64 is rw --> Str) is native {*}; # the actual interf +ace my int $time = $it; # the rest is synta +ctic sugar, really. ctime($time) }; # the actual call i +nto the C-library } say the-time; # Sun Jul 15 17:05:34 2018
And if you want to interface with your own C-code: turn it into a small library and call that using NativeCall. The t/04-nativecall directory contains several examples of how to do this. All in all, I'd say not having XS is a plus, rather than a minus. As it is XS out there in the wild, that is keeping Perl 5 from advancing in the multi-threaded world. Which is also why Perl 5 ithreads continue to have scalability issues for the past 15 years!
  • Comment on Re^5: It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?
  • Select or Download Code

Replies are listed 'Best First'.
Re^6: It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?
by syphilis (Archbishop) on Jul 17, 2018 at 12:05 UTC
    All in all, I'd say not having XS is a plus, rather than a minus

    Yes, not everyone views XS favourably. That's ok, I'm not going to try to convince you otherwise.
    But that's not my view.

    Cheers,
    Rob
      For those of us willing to be convinced, why is no-XS a minus for Perl6?
        ... why is no-XS a minus for Perl6?

        Obviously, given that I like perl's XS facility, from my POV it's going to be a "minus" that Perl6 doesn't provide that type of C interface. There's also the fact that XS can access static libs.

        On Windows, which is the OS I most commonly use, we have a module named Win32::API that, like perl6's Native Calling Interface, allows us to call directly into dynamic libraries.
        I neither like nor use Win32::API either. (In fact, I can't stand it.) I much prefer to do it via XS.

        Cheers,
        Rob
Re^6: It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?
by syphilis (Archbishop) on Jul 17, 2018 at 12:23 UTC
    But Perl 6 has the Native Calling Interface which allows you to "Call into dynamic libraries that follow the C calling convention".

    I only just noticed - that seems to imply that the Native Calling Interface is for use with "dynamic libraries" only.
    Hopefully there'd also be an interface to static libs ? (It's no big deal to me ... I'm simply curious about it.)

    Cheers,
    Rob
      There is no interface to static libs, as far as I know. At the moment, support for static libraries is very low on a long list of features waiting to be addressed. Sorry.
        support for static libraries is very low on a long list of features waiting to be addressed

        That would be a bit of an issue (but probably not a blocker) for me if I was wanting to code in perl6.
        On Windows I build static libs only where practicable.

        Cheers,
        Rob
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
    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
      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,
      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://1218511]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found