Yeah, that's a good compromise, I guess...
But fundamentally, one could argue that O(N/100) is still really O(N)...
My fear is in delivering a module to the CPAN, which is not complete (and hence you could say buggy) by design, algorithmically, although it doesn't necessarily have to be, technical difficulties aside.
For my data sets, which die rather quickly, I doubt 1000 accesses could be made before the hash is cleaned up anyway. For someone else, however, the hash may be seldom accessed, but large, and with many disappearing references as keys. Both of us don't gain much from such a solution.
I agree it is better than just leaving it that way, in that it mostly works most of the time. I think that for my purposes, though, ysth's solution seems like the most promising way to feel good about it. I reckon eventually I'll write several subclasses, that are interchangable, and chosen at use time.
Anyway, thanks... and I wondered how CDBI did it, but was too busy to look (with other stuff) since the problem came up... ;-)
| [reply] |
| [reply] |
In Class::DBI, we make the number of accesses configurable by the user, so that someone who doesn't care can skip the cleanup and someone who is really paranoid about it can do it frequently.
| [reply] |