[BEANUTILS-539] use Concurrent(Weak)HashMap (or anything both faster and have better thread safety) insteadof WeakFastHashMap#27
Conversation
please run it using Jprofiler or other tools to see cpu call tree.
|
feel free to ask for changes about this test, I will help to run it. |
|
Looks like you have some merge conflicts? Also I think this will resolve BEANUTILS-509: #21 |
Sorry for that. will fix it immediately.
I had no experience in using function Collections.synchronizedMap(), so I cannot tell about performance about that. |
|
detailed output of Jprofile is attached at link : https://issues.apache.org/jira/browse/BEANUTILS-539 |
|
-1. Do you understand the difference between a weak and strong reference in a map? Do you you know what will happen if you install this change in an application that keeps putting new keys in the map and then not keep references to them? |
…into change_WeakFastHashMap_to_ConcurrentHashMap � Conflicts: � src/main/java/org/apache/commons/beanutils2/BeanUtils.java � src/main/java/org/apache/commons/beanutils2/ConvertUtilsBean.java
|
@garydgregory I am having a hard time resyncing my fork all the sudden. I am getting this error "! refs/heads/master:refs/heads/master [remote rejected] (refusing to allow an OAuth App to create or update workflow |
So weak reference is important here? Fine. |
|
If your app does not need synchronization, you can use the map in "fast" mode. |
|
@garydgregory is org.apache.commons.logging.impl.WeakHashtable a better replacement of WeakFastHashMap in this cases? |
@garydgregory Any suggestions? |
|
IIRC I think someone contributed a concurrent weak hash map either in this component or in commons-collections, there should be a JIRA ticket... AFK ATM... |
well but it fails test
yes you are right, there be a jira ticket for a ConcurrentWeakHashMap, but nobody resolved it yet. |
|
also here is some guy contributed a concurrent weak hash map too : https://issues.apache.org/jira/browse/HARMONY-6434?jql=text%20~%20%22concurrent%20weak%20hash%20map%22 it also fails test MemoryLeakTestCase.testLocaleConvertUtilsBean_converters_memoryLeak. |
|
my bad. It said it be from Also, that lib is at apache license v2, so if we want to use it we must follow that license. Though I still think a ConcurrentWeakHashMap should have better performance... but WeakHashtable is far better than WeakFastHashMap. Only one more thing: WeakFastHashMap allows null key and null value(same as WeakHashMap do), So what should we do next? Actually there be several ways.
Which way should we enter? |
|
Just wait. I have a query on the legal mailing list to check to see if we can reuse the Infinispan version of its concurrent weak key hash map, and since it is co-authored by Doug Lea it likely one of the better if not the best implementation out there. |
@garydgregory Hi gary. |
|
@garydgregory any update from the lawyers? |
|
@garydgregory Just pinging you about this one again checking in? |
|
No, but let me poke around... |
|
Looks like Inifinispan is Apache 2.0 licensed if that matters and it looks like they no longer even use this class? Looks like it was removed in Infinispan 10.0 |
|
See: #37 |
|
@XenoAmess I think you are safe to close this PR as its subsumed by #37 |
@melloware Well, I'd rather close this pr AFTER #37 is merged. |
|
No problem. |
|
@XenoAmess now that 2.0.0-M1 is out you can officially close this! |
@melloware very very very gladly. |
throughtout my performance test (using Jprofiler), I found out WeakHashMap is far slower than ConcurrentHashMap.
add tests to show how slow it is.
please run it using Jprofiler or other tools to see cpu call tree.
https://issues.apache.org/jira/browse/BEANUTILS-539