Sunday, October 08, 2006
Kirk Pepperdine has written a guest article for the Java Specialists' newsletter about the DRY or Don't Repeat Yourself principle. While I agree with DRY, the important part of the article was his performance timing study. He compared using personsByName.put(firstName + lastName, person); versus personsByName.put(new CompositeKey(firstName, lastName), person); Cutting to the result of the test, the composite key cut the example's execution by 66% and reduced memory consumption by about 65Mb. Visit the link above for more details or simply use Composite keys from now on!
Posted by David Medinets at 10/08/2006 08:23:00 PM