Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11655 closed enhancement (fixed)

[patch] memory optimization

Reported by: shinigami Owned by: team
Priority: normal Milestone: 15.08
Component: Core Version: latest
Keywords: Cc:

Description

1) maps in getKeys/keySet are presized to avoid resizing/realocation of internals

2) DateUtils.fromString - most of method is refactored to new one returning long, used when OsmReader.readCommon. Look at it please;).

Change History (7)

by shinigami, 10 years ago

Attachment: memory.patch added

patch

comment:1 by bastiK, 10 years ago

Summary: memory optimization[patch] memory optimization

Please add "[patch]" in the title, otherwise your patches might get overlooked!

1) Interesting... Could you explain the (4 * keys.length) / 6 + 1-formula?

2) looks fine to me.

comment:2 by anonymous, 10 years ago

4/3 is from default load factor of hashmap, 1/2 because it takes only half of array, +1 to be sure.

comment:3 by bastiK, 10 years ago

Resolution: fixed
Status: newclosed

In 8574/josm:

applied #11655 - memory optimization (patch by shinigami, modified)

in reply to:  2 comment:4 by bastiK, 10 years ago

Replying to anonymous:

4/3 is from default load factor of hashmap, 1/2 because it takes only half of array, +1 to be sure.

Good to know, the official Java doc for HashMap is not making it particularly clear what the capacity refers to.
I've educated myself and changed the formula to get the supposedly optimal value.

comment:5 by Don-vip, 10 years ago

Milestone: 15.07

comment:6 by Don-vip, 10 years ago

Milestone: 15.0715.08

Milestone renamed

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.