A DESCRIPTION OF THE REQUEST :
LinkedHashMap$Entry.recordAccess() always does a remove()/addBefore() if accessInOrder = true. in some uses it is quite common to access the same element many times. it would be nice if recordAccess() would skip the remove()/addBefore() if the entry is already the first entry.
all that is needed is:
if (before != lm.header)
{
remove();
addBefore();
}
there are plenty of other optimizations that could be made but this one is so simple and yet can save 6 unnecessary assignments that it seems worthy
JUSTIFICATION :
w/o this a performance sensitive client might be inclined to keep a reference to the first entry themselves to circumvent LinkedHashMap's expensive get() overhead.
LinkedHashMap$Entry.recordAccess() always does a remove()/addBefore() if accessInOrder = true. in some uses it is quite common to access the same element many times. it would be nice if recordAccess() would skip the remove()/addBefore() if the entry is already the first entry.
all that is needed is:
if (before != lm.header)
{
remove();
addBefore();
}
there are plenty of other optimizations that could be made but this one is so simple and yet can save 6 unnecessary assignments that it seems worthy
JUSTIFICATION :
w/o this a performance sensitive client might be inclined to keep a reference to the first entry themselves to circumvent LinkedHashMap's expensive get() overhead.
- duplicates
-
JDK-8023463 Improvements to HashMap/LinkedHashMap use of bins/buckets and trees (red/black)
- Closed