diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-06-09 17:59:22 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2011-06-09 17:59:22 -0700 |
commit | 1e6b02643c7052a385dba041ffa7c7fd8b8a3ac8 (patch) | |
tree | ee53c83db94231b430181ef0cf0547d53aa0de1a /org.eclipse.jgit.storage.dht/META-INF | |
parent | 57853e494972e7a9a6248648fd9f8479844c5348 (diff) | |
download | jgit-1e6b02643c7052a385dba041ffa7c7fd8b8a3ac8.tar.gz jgit-1e6b02643c7052a385dba041ffa7c7fd8b8a3ac8.zip |
DHT: Use a proper HashMap for RecentChunk lookups
A linear search is somewhat acceptable for only 4 recent chunks, but
a HashMap based lookup would be better. The table will have 16 slots
by default and given the hashCode() of ChunkKey is derived from the
SHA-1 of the chunk, each chunk will fall into its own bucket within
the table and thus evaluate only 1 entry during lookup instead of 4.
Some users may also want to devote more memory to the recent chunks,
in which case expanding this list to a longer length will help to
reduce chunk faults, but would increase search time. Using a HashMap
will help this code to scale to larger sizes better.
Change-Id: Ia41b7a1cc69ad27b85749e3b74cbf8d0aa338044
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.storage.dht/META-INF')
0 files changed, 0 insertions, 0 deletions