in reply to Slow GC after Scalar::Util::weaken
Perl weak references are implemented as a singly-linked list. Destroying a weak reference is thus O(n) if you have n weak references to a particular variable. So destroying N weak references to the same variable is O(N**2).
Having 200k weak references to the same variable is not a normal use-case. I'm not surprised that it is slow.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Slow GC after Scalar::Util::weaken (O)
by ikegami (Patriarch) on Jun 03, 2010 at 18:30 UTC |