Branch: refs/heads/smoke-me/jkeenan/tonyc/ghpr-17583
  Home:   https://github.com/Perl/perl5
  Commit: 9b035438608e2bc0cfd9fd5719090670a6440bc0
      
https://github.com/Perl/perl5/commit/9b035438608e2bc0cfd9fd5719090670a6440bc0
  Author: Tony Cook <t...@develop-help.com>
  Date:   2020-02-26 (Wed, 26 Feb 2020)

  Changed paths:
    M op.c
    M op.h

  Log Message:
  -----------
  make freed op re-use closer to O(1)

previously freed ops were stored as one singly linked list, and
a failed search for a free op to re-use could potentially search
that entire list, making freed op lookups O(number of freed ops),
or given that the number of freed ops is roughly proportional to
program size, making the total cost of freed op handling roughly
O((program size)**2).  This was bad.

This change makes opslab_freed into an array of linked list heads,
one per op size.  Since in a practical sense the number of op sizes
should remain small, and insertion is amortized O(1), this makes
freed op management now roughly O(program size).

fixes #17555

Reply via email to