Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: java8 up to 6x slower than java7 Date: Sun, 16 Feb 2014 20:27:12 +0100 Organization: albasani.net Lines: 33 Message-ID: References: <29a51a94-8f9a-41b1-980f-e8c13e2d11a2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net wR8AK311NtoiRlUWx6gt5UHo4BhrZC8CcPnCTcdt/rCYA6ESQl1T8uTEhJDoMgjHhTPTkoQIOmMpjxnPrFvu8Q== NNTP-Posting-Date: Sun, 16 Feb 2014 19:27:21 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="+ZAUT8h4NV+d5NC2FuhBplp496VMOFTQoBMLRsJEFQ+3FGsasO7wO1ETh+Mq2WSsmHIfHgr4WxYEyqBwf6UkcUTD6JIleYAKIX2tSruDMODAF71/CEwWUC4s4W0MF9wt"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24 In-Reply-To: Cancel-Lock: sha1:37n8yDSFU+3y+R+hLjTWvdl5G+o= Xref: csiph.com comp.lang.java.programmer:27531 Hi, Robert Klemme schrieb: > For the long lived case you can still manually shrink by creating a new > collection if the nature of your application is such that there > temporarily the collection grows huge and afterwards shrinks again. You have this effect and can control this effect by an appropriate lower water mark choice. Without putting some special compaction points into your code. Overhead is only a compare instruction besides the compaction itself. It should be noted that you are true, that the compaction is not necessary. It does even make the hashing less good, since you have fewer bins. Normally a hash map that grows and grows, will nevertheless have smaller bin lengths when elements are removed again. Main reason I opted for automatic compaction of my hash maps was that my application has miriads of hash maps. Well not miriads, but a lot of hash maps. They are used for some just in time indexing, and are even recursively built, i.e. hash values that are again hash maps and so. So the requirement was really to have very light weighted hash maps for this data structure. Even if there is a small time overhead. Problem was that application crashed without compaction, since memory consumption was too high. Bye