On Tue, Aug 20, 2002 at 07:39:28PM +0200, Leopold Toetsch wrote: > > Dunno, how expensive getBucket is, but wouldn't it be faster, to check, > if a GC run was actually done, and only then recalculate the pointers? > This would apply too similar operations (clone ...) too.
Probably not worth it. getBucket() is cheap. Assuming it gets inlined, it's just (i == -1) ? NULL : &(struct->field->array)[i] Something like a test, branch, and two dereferences? Otherwise, it's temp = interpreter->collect_count; OPERATION if (interpreter->collect_count > temp) getBucket() which is a test, branch, and one dereference (the second will probably be cached.) Not much difference, and if no GC happened then getBucket() will probably benefit from the cache too.