1. Perl
  2. Version information
  3. here

Perl latest version 5.24 released - faster subroutine and math, Unicode 8.0 support, grammar enhancements

The latest version of Perl 5.24 has been released. In this release, Perl's subroutine and numerical calculations are faster. In terms of functionality, Unicode 8.0 is now supported. As a grammatical enhancement, the experimental status of forward dereference has been removed. Other minor bug fixes have been made.

Following Perl 5.22, Perl 5.24 includes improvements to Perl's internal code. Although it has the great advantage of improving performance, it also has some side effects, so I will explain it together.

If you're technically unfamiliar and want a stable Perl, Perl 5.20 is for now. If you're technically strong and want to improve performance or try new features, try Perl 5.24.

Below are some of the changes in Perl 5.24.

=====

Performance improvements

The biggest change in Perl 5.24 is the performance improvement.

Speeding up subroutine calls

Loops and blocks are faster because we have reduced the overhead of scope creation and termination as much as possible. For example, the following empty subroutine can be executed about three times faster than before.

sub f {} f ();

This is probably the most pleasing change in 5.24. One of Perl's problems was that subroutine calls were slow, which has improved one of the problems.

Uppercase and lowercase functions, regular expression performance improvements

Some languages, such as Chinese, are case insensitive. For such languages, skipping the logic improved the performance of the ucfirst function and "qr // i".

Speeding up substr

Substr has been accelerated on platforms that support memchr. The following process is about 7 times faster.

$s = "a" x 1000. "wxyz";
$s =~ /wxyz/for 1..30000

Speeding up addition/subtraction/multiplication

In Perl 5.8.0, numeric operations were slow to support 64-bit integers, but this slow logic has been improved. Perl is said to be slow in math, but it's a little better.

Improved performance of increment decrement

Perl's increment/decrement performance has been improved. Loop processing etc. will be a little faster.

Functional enhancement

Unicode 8.0 support

Unicode 8.0 is now supported. Perl has fast Unicode support

New regular expression\b{lb}

A new regular expression "\b{lb}" has been added to represent a line break.

Experimental status of forward dereference has been obtained

In Perl 5.24, forward dereference are enabled from the beginning. This makes it easier to describe the process of array slice, hash slice, partial hash acquisitions, and partial array acquisitions from the reference.

# Forward dereference
my $nums_ref = [1, 2, 3];
my @nums = $nums_ref->@*; # (1, 2, 3);

# Array slice with forward dereference
my @nums_part = $nums_ref->@[0, 2]; # (1, 3)

my $names_h_ref = {
  ken => 1,
  taro => 2,
  kimoto => 3
};

# Hash slice with forward dereference
my @names_part = $names_h_ref->@{'ken', 'kimoto'}; # (1, 3)

# Get partial hash using forward dereference
my %names_h_part = $names_h_ref->%{'ken', 'kimoto'}; # (ken => 1, kimoto => 3)

Incompatible changes

Some experimental features have been removed in this release.

Remove automatic dereference

The experimental automatic dereference that was issuing the obsolete warning has been removed. For example, the following processing will not work. You cannot pass reference to push, pop, shift, unshift, splice, keys, values, each.

The lexical $_ has been deprecated.

C was added experimentally in Perl 5.10, but it's obsolete.

Nested declarations are no longer allowed

Nested declarations are no longer allowed. The following description will result in a compilation error.

my ($x, my ($y));
our (my $x);

chdir('') can no longer be moved to home directory

chdir('') can no longer be moved to your home directory. Use chdir().

Known issues

In Perl 5.24, some modules that utilize non-guaranteed implementations are stuck due to internal improvements. This is currently being discussed by Perl's core team, so keep an eye on it.

  • Algorithm::Permute
  • Coro
  • Data::Alias
  • RPerl
  • Scope::Upper
  • TryCatch
  • lexical::underscore

Perl has a lot of internal improvements these days, so relying on grammatical variants that rely on internal APIs is risky.

Findings

It's a nice change to improve Perl's performance. I don't think this direction is wrong. This requires internal improvements, which breaks some grammatical variants.

In particular, the topic of Coro seems to be a big topic for discussion. In the future, I felt it would be better to support coroutines in the Perl core. This is because when a grammatical variant module is implemented as an external module, it can always be broken.

Related Informatrion