Posted by byhisdeeds
on August 15, 2007 at 7:40 PM PDT
I have a java application that requires me to sample hundereds of image files. To speed things up, I coded a Least Used List of a fixed size, of BufferedImages, that removed the least used entry when it required space for a new entry. I did this by using a priority queue to order a list of usage, as well as a hashmap to access the entries quickly.
it works ok, but I'm looking to optimise it and was wondering if anybody could tell me whether a Least Recently Used alogoritim would serve my purpose just as well. This would probably be faster, as I just keep the most recently accessed entry at the head of the list, and remove the tail when I need space.