benwtrent commented on code in PR #15124:
URL: https://github.com/apache/lucene/pull/15124#discussion_r2359887434
##########
lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java:
##########
@@ -426,10 +425,8 @@ public void clear() {
}
private static long getRamBytesUsed(Query query) {
- return LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY
- + (query instanceof Accountable accountableQuery
- ? accountableQuery.ramBytesUsed()
- : QUERY_DEFAULT_RAM_BYTES_USED);
+ long queryRamBytesUsed = RamUsageEstimator.sizeOf(query, 0);
+ return LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY + queryRamBytesUsed;
Review Comment:
I wonder if the query cache should "cache" the query sizes? It seems we do
this more expensive calculation twice for no reason. Why not keep track of the
query size in the cache as well, only calculating when adding it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]