neoremind edited a comment on issue #1875: [CALCITE-3873] Use global caching 
for ReflectiveVisitDispatcher implementation
URL: https://github.com/apache/calcite/pull/1875#issuecomment-611891530
 
 
   @hsyuan Thanks for your advice about softValues, 
[javadoc](https://guava.dev/releases/19.0/api/docs/com/google/common/cache/CacheBuilder.html)
 justifies : _Entries are automatically evicted from the cache when any of 
maximumSize, maximumWeight, expireAfterWrite, expireAfterAccess, weakKeys, 
weakValues, or softValues are requested._ 
   
   Actually now I am a little reluctant to the change, because according to 
benchmark, by using Guava global cache, the overhead is a little bigger than 
just looking up method by Reflection every time (<20 ns/op gap), and the most 
performant option is to use JDK ConcurrentHashMap as global cache but without 
size limitation and expiration for GC. The master branch version may call 
Reflection the first time, and then will use JDK HashMap as cache in instance 
level which does not bad. 
   
   So my opinion is, if we can not use JDK ConcurrentHashMap as global cache, 
then the update may no longer necessary. Hopefully the unit test and benchmark 
could be useful after all. Sorry for making the thread so long.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to