4 ms·
This is a very promising solution. If it has a fatal problem (I'm not sure it does), it would be the cost of searching back through the referrer chain to look f
by putzdown 10y ago
This is a very promising solution. If it has a fatal problem (I'm not sure it does), it would be the cost of searching back through the referrer chain to look for a root pointer. Am I wrong in thinking that that will be at least O(n), if not O(n^2)? And n could be extremely large—as large as the number of objects in your program.
To say it another way: what we (C++ programmers, stereotypically) don't like about GC is that it incurs long search costs at unpredictable intervals. That long search cost is not dissimilar in nature (i.e. in algorithm) to the cost of this search. So it's not clear to me that the performance characteristics of `internal_ptr` would be much different from those of GC. I'd like to see the performance characteristics of the solution filled out with more detail.