Front page | perl.perl5.porters |
Postings from November 2016
Re: A possible new approach to COW - COW_META.
Thread Previous
|
Thread Next
From:
demerphq
Date:
November 7, 2016 08:55
Subject:
Re: A possible new approach to COW - COW_META.
Message ID:
CANgJU+XGovxBcm7+E=aKhEhpz9BUEotvrs0=xzXNQddq1v76KQ@mail.gmail.com
On 6 November 2016 at 21:50, Father Chrysostomos <sprout@cpan.org> wrote:
>
> On Nov 6, 2016, at 7:13 AM, demerphq <demerphq@gmail.com> wrote:
>
> Have you benchmarked it at all? I tried something similar at first (but not quite as clean), and found that it made things slower than no COW at all.
No I haven't. My aim has been completeness. Once complete and correct
we can look at performance.
FWIW, I think it is important to understand my motivation here.
The regex engine is one of the places where an inability to COW a
buffer shows up as a serious performance regression. I have played
whack-a-mole with various overallocation vectors and frankly I am
getting tired of it.
So I want a COW that is complete, and never triggers these performance
issues. So my view is that slowing down COW a little bit on some
shorter strings is acceptable, provided it means we do not see huge
slowdowns in things like regex matching.
If my changes mean that we, say, double the minimum size string worth
COWing, but ensure that *everything* larger is COWable then from the
POV of the regex engine it is an improvement. Now of course this is my
opinion only, but when a regex match goes from 22k a second, to 3k a
second because COW cant find a refcnt byte I think its worse than if
COW goes from 1 nanonsecond to 2 nanonseconds. IMO predictably
acceptable performance is better than unpredictable performance that
is sometimes unacceptably slow.
This is also why I continue to look into using COW for LEN=0 buffers
like those from Perlio. Since we dont modify the buffer under COW
anymore it means we can COW these pointers in things like the regex
engine matching, further improving the predictability of its
performance.
So you see, my POV may differ from yours. I want to save memory on
long strings, and not have the regex engine go from linear to
quadratic when a buffer cant be refcounted. I recognize that this a
judgement call that others, like yourself, may think differently
about.
Again, none of this should be taken as criticism of your choices.
Choices about trade offs need to be made in these kind of endeavours,
and not everybody prioritises the same properties the same way, and I
recognize that yours are just as valid as mine. And again, I really
appreciate all the work you did on this. I learned a new level of
appreciation of your and our other colleagues skill while working on
this. It is much easier to hack on the regex engine than it is to hack
on COW.
Yves
Thread Previous
|
Thread Next