Perl 5.28 released - Unicode 10.0 support, faster string concatenation, ref function, keys function, faster for loop

Perl 5.28 was released on June 22, 2018. Introducing some nice features in Perl 5.28.

Unicode 10.0 support

Unicode 10.0 is now supported. It seems that 56 kinds of new emoji can be used.

Speeding up string concatenation

Multiple string concatenation has been sped up. This is because it is now processed internally by a single opcode called multiconcat.

Code like the following will be accelerated.

    $s. = "a = $a b = $b\n"

For example, on an x86_64 system, the following string concatenation code is four times faster.

    my $s;
    my $a = "ab\x{100} cde";
    my $b = "fghij";
    my $c = "\x{101} klmn";

    for my $i (1..10_000_000) {
        $s = "\x{100} wxyz";
        $s. = "foo = $a bar = $b baz = $c";
    }

In addition, sprintf, which contains constant strings, has also been optimized using multiconcat.

Speeding up the ref function

The ref function is now much faster in boolean contexts. This is because the boolean context no longer creates temporary strings.

Speeding up the keys function

The keys function has been more optimized in the scalar context.

Speed up for loop

For loops and similar syntax have become more efficient in most cases.

Perl - i replacement is safe

Replacing file contents with perl -i is now safer as it is backed up during editing.

Fixed a bug that cannot be installed on Cent OS 5

Perl 5.26 couldn't be installed on Cent OS 5, but Perl 5.28 allows it to be installed. Try it in my environment and see if it can be installed!

Attribute position changed in experimental subroutine signature

The position of the attribute in the experimental subroutine signature has changed.

Before change sub foo ($foo, $bar): attr;
After change sub foo: attr ($foo, $bar)

Incompatible changes

Perl requires C89

A compiler that can compile C89 is now required to compile Perl. It's not C99 or C11, so don't get me wrong.

Setting the value to ${^ENCODING} is invalid

Please note if anyone has set ${^ENCODING} in the past.

The sort algorithm by the sort pragma can no longer be specified

You can no longer specify the sort algorithm with the sort pragma. The Perl default sort algorithm is always used.

Perl 5.28 release miscellaneous thoughts

I feel that this release focuses on small performance improvements. I'm very happy that the improved string performance benefits all Perl users.

In recent Perl, the boolean context has been refactored so that 1 is returned where it doesn't have to return a string, which leads to faster speeds.

The latest Perl can be installed on Cent OS 5, which is still long-lived, and it feels like "Once you write it, Perl will work anywhere."

Related Informatrion