Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: b9eeeef8c043fb0238a07e64636815bf327a6562
      
https://github.com/Perl/perl5/commit/b9eeeef8c043fb0238a07e64636815bf327a6562
  Author: Lukas Mai <lukasmai....@gmail.com>
  Date:   2025-02-16 (Sun, 16 Feb 2025)

  Changed paths:
    M op.c
    M t/op/sub.t

  Log Message:
  -----------
  op.c: re-enable coderef-in-stash optimization

When seeing 'sub foo { ... }', perl does not need to allocate a full
typeglob (with the subroutine being stored in the CODE slot). Instead,
it can just store a coderef directly in the stash.

This optimization was first announced in perl5220delta:

> - Subroutines in packages no longer need to be stored in typeglobs:
>   declaring a subroutine will now put a simple sub reference directly
>   in the stash if possible, saving memory. The typeglob still
>   notionally exists, so accessing it will cause the stash entry to be
>   upgraded to a typeglob (i.e. this is just an internal implementation
>   detail).  This optimization does not currently apply to XSUBs or
>   exported subroutines, and method calls will undo it, since they
>   cache things in typeglobs.  [GH #13392]

However, due to a bug this optimization didn't actually work except for
package main (GH #15671). The issue was fixed in v5.27.5, but the fix
was backed out again in v5.27.9 because of CPAN breakage.

This patch re-enables the optimization because I want to see what the
current state of CPAN breakage is.


  Commit: 40812846772742f13ee5ffc83f4be0c451f24c62
      
https://github.com/Perl/perl5/commit/40812846772742f13ee5ffc83f4be0c451f24c62
  Author: Lukas Mai <lukasmai....@gmail.com>
  Date:   2025-02-16 (Sun, 16 Feb 2025)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta for coderef-in-stash optimization


Compare: https://github.com/Perl/perl5/compare/7fdc8f34fd20...408128467727

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to