vlsi / compactmap Goto Github PK
View Code? Open in Web Editor NEWMemory efficient java.util.Map implementation modelled after http://code.google.com/apis/v8/design.html
License: Apache License 2.0
Memory efficient java.util.Map implementation modelled after http://code.google.com/apis/v8/design.html
License: Apache License 2.0
first deserialization, if key order is:
key1
key2
key3
sencond deserialization, if key order is:
key2
key3
key1
when do deserialize multiple times use compactmap , will trigger OOM
Hi and thank you for making this data structure.
I am writing a java server and have some memory issues. So I wanted to use compactHashMaps. I tested the code with both compactHashMap and normal java HashMap and it seems like the compactHashmap makes my code get an out of memory exception before the original HashMap.
I am running on a ubuntu machine and my java version is java 8. The code is fairly simple and I simply change the type of the data from hashMap for compacyHashMap (mostly just in the declarations) since the methods seem to be similar. I can provide the code if further information was required.
Thank you
@Test
public void removeShouldBeReflectedInSize() {
CompactHashMap<String, Object> map = new CompactHashMap<String, Object>();
map.put("charset", "UTF-8");
map.remove("charset");
Assert.assertEquals(map.size(), 0);
Assert.assertFalse(map.containsKey("charset"));
}
Currently default values are serialzed as a regular key-value pairs.
Thus map provide no improvement on the serialized footprint.
Default values should be serialized as separate map, so it would be shared between different compact maps.
Hello,
when storing large map onSavedInstanceState it crashes with TransactionTooLargeException.
Do you have any solution ?
LGPL has lots of issues. For instance, LGPL is "category X" in Apache Software Foundation: https://apache.org/legal/resolved.html#category-x
Hi, is there anything preventing from support of null
keys?
I understand that underneath dexx collection is used.
But is that the limitation or compactmap itself?
Exception in thread "main" java.lang.NullPointerException
at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.elemHashCode(CompactHashMap.java:78)
at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.computeHash(CompactHashMap.java:89)
at com.github.andrewoma.dexx.collection.internal.hashmap.CompactHashMap.get(CompactHashMap.java:65)
at com.github.andrewoma.dexx.collection.HashMap.get(HashMap.java:102)
at vlsi.utils.CompactHashMapClass.put(CompactHashMapClass.java:76)
at vlsi.utils.CompactHashMap.put(CompactHashMap.java:105)
PS. we see huge memory savings with help of this library
Hi Vladimir,
The https://github.com/vlsi/compactmap/blob/master/compactmap/src/main/java/vlsi/utils/CompactHashMapClassEmptyDefaults.java file still has the old LGPL-3.0 source header on it, in addition to the Apache-2.0 new header. Was this intentional?
@Test
public void containsKeyOnNonExistingKey() {
CompactHashMapDefaultValues.add("k1", "v1");
CompactHashMap<String, Object> map = new CompactHashMap<String, Object>();
Assert.assertFalse(map.containsKey("abcd"));
Assert.assertFalse(map.containsKey("k1"));
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.