WeakConcurrentHashMap icon indicating copy to clipboard operation
WeakConcurrentHashMap copied to clipboard

Performances

Open ChocolatMilka opened this issue 4 years ago • 2 comments

Hey, I have some suggestions for better performance.

  • You can use EntrySet instead of KeySet for better performance
  • And, I will advise you use ScheduledExecutorService instead of Thread sleeping
  • You can also use "final" keyword to help the Carbage Collector (slightly but still worth it)

😉

ChocolatMilka avatar Mar 05 '21 14:03 ChocolatMilka

And when you set mapAlive to false, I advise you to keep running the thread to remove the data that is still cached (or clear everything when mapAlive is false, or, alternatively, if mapAlive is false and clear() is called: automatically stop the thread because there is no more value to clean up).

ChocolatMilka avatar Mar 05 '21 14:03 ChocolatMilka

Thanks for your suggestions, will look into it.

On Fri, Mar 5, 2021 at 8:17 PM 360matt @.***> wrote:

And when you set mapAlive to false, I advise you to keep running the thread to remove the data that is still cached (or clear everything when mapAlive is false, or, alternatively, if mapAlive is false and clear() is called: automatically stop the thread because there is no more value to clean up).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vivekjustthink/WeakConcurrentHashMap/issues/1#issuecomment-791464426, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSINJJEJVPBI73BR2WJUL3TCDVGTANCNFSM4YVKUN4A .

-- With Regards

    Vivekananthan

Mobile : +919095539096 Twitter : vivekjustthink Skype : vivekjustthink

vivekjustthink avatar Mar 23 '21 05:03 vivekjustthink