Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 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;).

Attachments (1)

memory.patch (4.3 KB) - added by shinigami 6 years ago.
patch

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by shinigami

Attachment: memory.patch added

patch

comment:1 Changed 6 years ago by bastiK

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 Changed 6 years ago by anonymous

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

comment:3 Changed 6 years ago by bastiK

Resolution: fixed
Status: newclosed

In 8574/josm:

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

comment:4 in reply to:  2 Changed 6 years ago by bastiK

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 Changed 6 years ago by Don-vip

Milestone: 15.07

comment:6 Changed 6 years ago by Don-vip

Milestone: 15.0715.08

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.