develooper Front page | perl.perl5.porters | Postings from April 2020

TONYC TPF Grant 13 report 15

Tony Cook
April 3, 2020 00:37
TONYC TPF Grant 13 report 15
Message ID:
[Hours]         [Activity]
2020/10/17      Saturday
 3.10           #17555 finish up freeing, try reallocation from the new
                structure and bugs
 1.62           #17555 debugging and some fixes, still something wrong

2020/10/18      Sunday
 2.42           #17555 more debugging
 1.37           #17555 research, debugging

2020/02/19      Wednesday
 2.22           #17555 more debugging
 2.20           #17555 more debugging

2020/02/20      Thursday
 0.50           require change of behaviour thread
 1.87           #17555 debugging
 0.82           #17555 debugging
 0.38           #17572 review and briefly comment, irc discussion

Which I calculate is 16.5 hours.
Approximately 2 tickets were reviewed or worked on.

This was a very frustrating week.

This was my first attempt to fix which was (apparently)
introduced by 9f601cf3bb which sped up up feature checks by adding an
extra bitmask to COP.

This significantly slowed down loading Number::Phone::StubCountry::CN,
which took about 150 times as long to load.

Profiling with callgrind led me to finding that before 9f601cf3bb the
loop searching for freed ops of a sufficient size was running 4.8e+8
times, but after it was running 3.5e10 times.

It took me a while, but I eventually came to the conclusion that this
was because the COP was now larger, and wasn't being found as a freed

In this case I tried to restructure the freed list as a list of lists:

  head op of size N  (op_next)-> more freed ops of size N
    | (op_sibparent)
  head op of size N+M (op_next)-> more freed ops of size N+M

The intent here was to avoid changing the size of the opslab structure
which would allow this to be more back-portable to maint perls*, and
the fields involved are only used in the head slab, and not the rest
of the slabs hanging of a CV.  It would have made searches for freed
ops O(number of freed op sizes), unfortunately insertion of freed ops
would have also been roughly O(number of freed op sizes) vs the O(1)
of the previous insertion.

Unfortunately this change led to a number of tests asserting, and I
spent most of my time trying to find what I'd messed up.

I now suspect that by modifying op_sibparent the code in op_free()
which can handle ops that have been passed to FreeOp() was messing up
the op tree walk that op_free() does, leading to the assertions.

I'll discuss the eventual solution in the report for the week it was
done in.

* that said, this is a structure definition protected by PERL_CORE, so
  no-one else is using it, right? Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About