in reply to Perl5 patches

After thinking som more about it, you most likely are on the hunt for the increase in memory consumption resp. cause of the lvalue substr memory consumption.

If you have the time and machine, there is bisect-runner.pl in recent versions of Perl (starting somewhere in the 5.15.x series) that will chug through the commits starting from a known good (or known bad) version, and find the commit where the behaviour switches.

Replies are listed 'Best First'.
Re^2: Perl5 patches
by BrowserUk (Patriarch) on Mar 18, 2012 at 11:23 UTC

    It looks like the change was a deliberate choice in response to the issues raised 9 or 10 years ago by my earlier posts on the issue of lvalue refs.

    As far as I'm concerned, lvalue refs have never been made to work the way they intuitively should. And the way they do work entirely limits their usefulness. Limits it to the point of almost uselessness. The utterly unnecessary wholesale duplication of referenced substring is just mockery.

    And taking a look into the current implementation of substr it is no wonder that it is so slow. The result of all the different tweaks and modifications over the years by so many different hands attempting to fix the lvalues refs; signed/unsigned 32-bit offsets and unicode problems -- further compounded with the stupid indentation -- make it look like it was coded by a rank beginner with no concept of basic coding principles -- like DRY.

    The only way to fix it -- and all the problems that still afflict it -- would be to start again from scratch. And we both know the likelihood of that ever happening.

    The only solution I can think of is to write a module that overrides CORE::GLOBAL::substr and implements it in a sane fashion. But given the overhead of calling back into perl, that's not going to be performant either.

    All in all, it's a depressing state of affairs.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      You can override CORE::GLOBAL::substr from C as well.

      Approaching that issue with a separate rewrite would be the approach to take in my eyes. That way, the replacement can conveniently be tested against CPAN before the change is merged back into mainstream Perl.

        You can override CORE::GLOBAL::substr from C as well.

        Any pointers?


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?