digitalmars.D - .rehash
- bearophile (4/4) Sep 30 2008 I think D builtins lack some very useful methods (member functions), lik...
- dsimcha (7/7) Sep 30 2008 Rehash is nice, in my experience, for the specific but common usage case...
- bearophile (4/11) Sep 30 2008 Have you timed your real programs (not benchmarks) and seen an actual im...
I think D builtins lack some very useful methods (member functions), like an index() for the arrays, a dup/deepdup for the associative arrays, and so on. On the other hand I have tried to use the .rehash method few times, but most times its usage increases the total running time of my small program. So do you use the rehash method? If not enough people find it useful, then it may be removed, simplifying the API (freeing *brain* space for more important methods). Bye, bearophile
Sep 30 2008
Rehash is nice, in my experience, for the specific but common usage case of dumping tons of data into an AA, and then using it for lots of read-only access after it's been built. Hash collisions greatly hurt the performance of AAs. Rehash basically increases the hash space if necessary, to lessen hash collisions at the price of slightly more memory usage and some upfront processing time. This happens anyway occasionally as your AA gets larger, but calling .rehash makes it happen explicitly.
Sep 30 2008
dsimcha:Rehash is nice, in my experience, for the specific but common usage case of dumping tons of data into an AA, and then using it for lots of read-only access after it's been built. Hash collisions greatly hurt the performance of AAs. Rehash basically increases the hash space if necessary, to lessen hash collisions at the price of slightly more memory usage and some upfront processing time. This happens anyway occasionally as your AA gets larger, but calling .rehash makes it happen explicitly.Have you timed your real programs (not benchmarks) and seen an actual improvement of their global running times? Bye, bearophile
Sep 30 2008