Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Monday June 29 2020, @08:43AM   Printer-friendly
from the out-with-the-old,-in-with-the-new dept.

Submitted via IRC for TheMightyBuzzard

This morning at The Perl Conference in the Cloud, Sawyer X announced that Perl has a new plan moving forward. Work on Perl 7 is already underway, but it's not going to be a huge change in code or syntax. It's Perl 5 with modern defaults and it sets the stage for bigger changes later. My latest book Preparing for Perl 7 goes into much more detail.

Perl 7.0 is going to be v5.32 but with different, saner, more modern defaults. You won't have to enable most of the things you are already doing because they are enabled for you. The major version jump sets the boundary between how we have been doing things and what we can do in the future.

Remember, Perl was the "Do what I mean" language where the defaults were probably what you wanted to do. In Perl 4 and the early days of Perl 5, that was easy. But, it's been a couple of decades and the world is more complicated now. We kept adding pragmas, but with Perl's commitment to backward compatibility, we can't change the default settings. Now we're back to the old days of C where we have to include lots of boilerplate before we start doing something:
[...]
This is slightly better with v5.12 and later because we get strict for free by using setting a minimum version:
[...]
Perl 7 is a chance to make some of these the default even without specifying the version. Perl 5 still has Perl 5's extreme backward compatibility behavior, but Perl 7 gets modern practice with minimal historical baggage.

Source: https://www.perl.com/article/announcing-perl-7/


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Interesting) by bzipitidoo on Monday June 29 2020, @01:33PM (5 children)

    by bzipitidoo (4388) on Monday June 29 2020, @01:33PM (#1014056) Journal

    When I last tried Perl 6, some 3 years ago, it was dog slow. Just to read in a 100M file, one byte at a time, took 20 minutes. Same program in C took 2 seconds. Good to hear that they've optimized. Wonder how fast it could read 100M now?

    I saw the Perl 6 -> Raku name change a few months ago. The fact that they're rolling out Perl 7 for the new name, rather than Perl 6, suggests that the renaming to Raku will never totally stick.

    Starting Score:    1  point
    Moderation   +1  
       Interesting=1, Total=1
    Extra 'Interesting' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 1, Interesting) by Anonymous Coward on Monday June 29 2020, @03:59PM

    by Anonymous Coward on Monday June 29 2020, @03:59PM (#1014125)

    I think the jump to Perl 7 is so that if someone did a web search for "Perl 6 do X" they don't get code snippets from Raku instead of for Perl 6.

    I just tested file IO and you're correct, it is horrifically slow. Small files are fine - I have a web media server written in Raku running right now without issues. But reading a 100MB file from a spinning platter drive took almost 10 minutes and used many GB (?) of memory. There are features you can use to improve speed and reduce memory usage, but the defaults shouldn't be this wildly bad. Thanks for mentioning it, I'm going to open a Github issue.

  • (Score: 1, Interesting) by Anonymous Coward on Monday June 29 2020, @04:53PM

    by Anonymous Coward on Monday June 29 2020, @04:53PM (#1014154)

    There must be some things I misunderstand in their IO subsystem. I took a random 100MB file and this C program (my C is rusty, I just downloaded it and hacked it until it worked):

    #include

    struct rec { unsigned char x; };

    int main() {

    int counter; FILE *ptr_myfile; struct rec my_record;

    ptr_myfile=fopen("junk.bytes","rb");

    for ( counter=1; counter
    fread(&my_record,sizeof(struct rec),1,ptr_myfile);

    if (counter > 99999990) {

          printf("%d\n",my_record.x);

    } // end if

    }// end loop

    fclose(ptr_myfile);

    return 0; } // end file

    That took 1.06 seconds to run, unoptimized (just "gcc main.c; ./a.out").

    This Raku program ran in 0.34 seconds (faster than the C, not a typo):

    my $fh = open "junk.bytes", :r, :bin;

    my $x = $fh.slurp;

    say "Read " ~ $x.bytes ~ ".";

    for (1..10) { say $x.pop(); }

    That gave the same final bytes as C, but in reverse order (because I'm in a hurry). So Raku can be fast, but some of the IO calls that seem intuitive must be bad/odd ?

  • (Score: 0) by Anonymous Coward on Monday June 29 2020, @06:57PM (2 children)

    by Anonymous Coward on Monday June 29 2020, @06:57PM (#1014211)

    Okay, I've done more testing because you got me interested. Short summary: unbuffered IO is dreadfully slow, buffered IO is adequately fast but still not as fast as other scripting languages.

    I took a 100 million byte binary file and then wrote six programs to traverse the file and print the last few bytes. Raku 2020.06 single byte read: almost 14 minutes. Raku 2020.06 read in 64k buffered chunks: 0.35 seconds (Raku 'Hello World is 0.22 seconds.), and Raku on my machine has a 0.22 seconds tartup time. C single byte read: 1.04 seconds. C read in 64k buffered chunks: 0.021 seconds. Python single byte read: 17 seconds. Python read in 64k buffered chunks: 0.06 seconds (Python 'Hello World' is 0.01 seconds.).

    So with 64k buffered reads, Raku is 6 times slower than C and 3 times slower than Python (if you ignore the startup overhead). With the single byte (unbuffered) reads, Raku is around 750 times slower than C and 50 times slower than Python. Damn.

    • (Score: 2) by bzipitidoo on Monday June 29 2020, @09:46PM (1 child)

      by bzipitidoo (4388) on Monday June 29 2020, @09:46PM (#1014267) Journal

      I expect one reason the C program is so fast is that, under the hood, the C stdio library really is buffering the file read even when the program is reading only one byte at a time. Evidently, Raku is not.

      I guess it comes down to whether an app programmer should have to worry about I/O buffering, or not. And the way programming has evolved over the years, with the pushing of everything that can be pushed off to the computer, such as memory management (smart pointers) and hashing, then, absolutely yes, buffering for fast I/O should be the system's problem, not the programmer's problem. Thanks for looking into this.

      • (Score: 0) by Anonymous Coward on Tuesday June 30 2020, @12:35AM

        by Anonymous Coward on Tuesday June 30 2020, @12:35AM (#1014320)

        Thank you - I jump at any excuse to play with Raku, and I was upset when I saw such terrible performance. I'm not thrilled with a 6x gap, but for most tasks that's acceptable.