in reply to Re^4: Which, if any, is faster? (20% faster/ 40% smaller)
in thread Which, if any, is faster?
I read the following as array-based objects are 20% faster and 70% 40% smaller than the hash based equivalent for little extra effort and no loss of clarity.
Depends on what you're doing. Even with this simple case I'd argue that having to maintain the array indices constants away from new() already make it slightly less clear.
Once you have inheritance of array based objects it gets tricker since you have to keep the constants in sync between the parent and child classes. Remembering whether you've used array index 8 is a lot harder than remembering if you've used hash key something_the_parent_does.
Once you start refactoring classes and moving object fields between classes, adding fields to classes, etc. I find array based objects becomes a complete PITA.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Which, if any, is faster? (20% faster/ 40% smaller)
by BrowserUk (Patriarch) on Jun 02, 2005 at 08:22 UTC | |
by adrianh (Chancellor) on Jun 02, 2005 at 15:39 UTC |