The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

perldelta - what is new for perl v5.35.11

DESCRIPTION

This document describes differences between the 5.35.10 release and the 5.35.11 release.

If you are upgrading from an earlier release such as 5.35.9, first read perl53510delta, which describes differences between 5.35.9 and 5.35.10.

Core Enhancements

New functions builtin::created_as_string and builtin::created_as_number

These new functions allow code to inspect whether a defined but non-referential scalar value originated from an expression that was string-like in nature, or number-like. While most uses within Perl should not care about such distinctions, this can be useful when serialising or encoding Perl data structures for export to other languages or data formats where such a distinction does matter.

Support for not sharing all keys in large hash tables.

This release includes support to build Perl so that it does not share all keys in hash tables as has been historically the case since Perl v5.6. The shared key behavior was added to Perl originally to support having many objects with the same keys without having to store each key many times. For objects that might be created hundreds or thousands of times this key sharing behavior can result in using significantly less memory. However, key sharing comes at the cost of having to maintain an internal "master hash table" (PL_str_tab), and having to do two store operations per key stored in a hash table. It also can result in surprising consequences with programs that fork, causing the master hash table to be COWed (copy on write) into the memory space for each forked process which can, in worst case, greatly increase the memory utilization of such scripts.

The new behavior is an attempt to have our cake and eat it too. Small hash tables will continue to share keys, but once the hash table is used to store more than a certain number of keys (currently 64) it will not share the new keys that are added. This should benefit scripts that build large hash tables, especially those that do so in forked sub-processes. The unshared mode is triggered when the hash table is resized which is non-deterministic and depends on the underlying hash function that perl has been built with and the seed used by the current process so the exact circumstances when this new mode will be enabled for a given hash will vary between different invocations of a script.

We are uncertain of the exact effects of this new mode and are keen to get field reports about the consequences of enabling it. We know that in many cases not sharing keys speeds up scripts in general, and may result in a reduction in memory consumption. Code that builds large hashes where the keys are stored in only one hash, for instance where the keys are message digests, will likely benefit from this change by being faster and using less memory. However, there are also circumstances where not sharing keys can significantly increase memory consumption, such as where large numbers of keys are stored in multiple hash tables at once. We have data to suggest that not sharing keys will reduce COW churn and overall memory consumption in scripts that fork and construct large hash tables, however such scripts may also encounter a modest speed penalty. Overall, the consequences of not sharing keys will vary depending on workload. However, we believe that broadly speaking enabling this feature will be beneficial for most of our users. We would like to get data from the field to validate our assumptions.

We are not enabling the new mode by default in this release as we want to gather more data and obtain feedback from the field about how it affects people's scripts, but our intention is to ship the next release of Perl, version 5.38, with some form of this functionality enabled. We are hopeful that people will try to build their perls with this feature and provide us feedback on the results. This will help guide our next steps. So please try it and send feedback to the porters mailing list.

You can enable this new feature by passing

    -Accflags='-DPERL_USE_UNSHARED_KEYS_IN_LARGE_HASHES'

to Configure during the Configuration process.

Big thanks to Nicholas Clark for all the hard work in implementing this new feature.

Modules and Pragmata

Updated Modules and Pragmata

  • B::Deparse has been upgraded from version 1.63 to 1.64.

    Deparse now tries harder to preserve the original type of numeric constants, so !0 is deparsed as '!0' rather than '1', 2.0 is deparsed as '2.0' rather than '2' etc. The 'use/no warnings' lines for custom warnings categories are now fully handled - in the previous few releases only a small number of categories were correctly handled.

  • bignum has been upgraded from version 0.64 to 0.65.

  • Compress::Raw::Bzip2 has been upgraded from version 2.101 to 2.103.

  • Compress::Raw::Zlib has been upgraded from version 2.101 to 2.103.

  • Encode has been upgraded from version 3.16 to 3.17.

  • IO has been upgraded from version 1.49 to 1.49_01.

  • IO-Compress has been upgraded from version 2.102 to 2.106.

  • libnet has been upgraded from version 3.13 to 3.14.

  • Locale::Maketext has been upgraded from version 1.30 to 1.31.

  • Math::BigInt has been upgraded from version 1.999829 to 1.999830.

  • Math::BigRat has been upgraded from version 0.2620 to 0.2621.

  • Module::CoreList has been upgraded from version 5.20220320 to 5.20220420.

  • re has been upgraded from version 0.42 to 0.43.

  • Socket has been upgraded from version 2.032 to 2.033.

  • Storable has been upgraded from version 3.25 to 3.26.

  • Test::Harness has been upgraded from version 3.43 to 3.44.

  • Text::ParseWords has been upgraded from version 3.30 to 3.31.

  • Time::HiRes has been upgraded from version 1.9769 to 1.9770.

  • Unicode::Normalize has been upgraded from version 1.30 to 1.31.

Documentation

Changes to Existing Documentation

We have attempted to update the documentation to reflect the changes listed in this document. If you find any we have missed, open an issue at https://github.com/Perl/perl5/issues.

Additionally, the following selected changes have been made:

perlfunc

  • Add the new flow-control keywords (try, catch, finally and defer).

Removed Documentation

  • The long-obsolete README.macos (aka the perlmacos manpage) has been removed.

Configuration and Compilation

  • A new question has been added to Configure, to ask if you want to build perl with taint support. If you say "no", then all taint features, such as the -T and -t switches, will silently do nothing. It defaults to "yes", so if you run Configure accepting all defaults, you'll get a perl which supports taint just like before.

    If you're used to running Configure in "batch mode", here's how you'd build Perl without taint support:

     ./Configure -des -Utaint_support

    You can check the taint_support key in the %Config hash (in the Config module) to determine whether your perl supports taint. If the key doesn't exist in the hash, then you're almost certainly running under an older perl which predates this change, and you can assume that taint is support. See perlsec for more details.

Testing

Tests were added and changed to reflect the other additions and changes in this release.

Selected Bug Fixes

  • Early bailout from the inner one of a pair of nested lookbehinds could cause the outer lookbehind to give the wrong answer. [GH #19557].

  • ACCEPT inside of a (...)+ now works as expected. [GH #19484].

Acknowledgements

Perl 5.35.11 represents approximately 4 weeks of development since Perl 5.35.10 and contains approximately 42,000 lines of changes across 360 files from 24 authors.

Excluding auto-generated files, documentation and release tools, there were approximately 36,000 lines of changes to 250 .pm, .t, .c and .h files.

Perl continues to flourish into its fourth decade thanks to a vibrant community of users and developers. The following people are known to have contributed the improvements that became Perl 5.35.11:

Bram, brian d foy, Dagfinn Ilmari Mannsåker, David Mitchell, Eugen Konkov, Graham Knop, Hugo van der Sanden, James E Keenan, Karl Williamson, Leon Timmermans, Magnus Woldrich, Neil Bowers, Niyas Sait, Paul Evans, Paul Marquess, Ricardo Signes, Richard Leach, Sawyer X, Sergey Poznyakoff, Sisyphus, Steve Hay, Todd Rinaldo, Tony Cook, Yves Orton.

The list above is almost certainly incomplete as it is automatically generated from version control history. In particular, it does not include the names of the (very much appreciated) contributors who reported issues to the Perl bug tracker.

Many of the changes included in this version originated in the CPAN modules included in Perl's core. We're grateful to the entire CPAN community for helping Perl to flourish.

For a more complete list of all of Perl's historical contributors, please see the AUTHORS file in the Perl source distribution.

Reporting Bugs

If you find what you think is a bug, you might check the perl bug database at https://github.com/Perl/perl5/issues. There may also be information at http://www.perl.org/, the Perl Home Page.

If you believe you have an unreported bug, please open an issue at https://github.com/Perl/perl5/issues. Be sure to trim your bug down to a tiny but sufficient test case.

If the bug you are reporting has security implications which make it inappropriate to send to a public issue tracker, then see "SECURITY VULNERABILITY CONTACT INFORMATION" in perlsec for details of how to report the issue.

Give Thanks

If you wish to thank the Perl 5 Porters for the work we had done in Perl 5, you can do so by running the perlthanks program:

    perlthanks

This will send an email to the Perl 5 Porters list with your show of thanks.

SEE ALSO

The Changes file for an explanation of how to view exhaustive details on what changed.

The INSTALL file for how to build Perl.

The README file for general stuff.

The Artistic and Copying files for copyright information.