thomasmueller / minperf Goto Github PK
View Code? Open in Web Editor NEWA Minimal Perfect Hash Function Library
License: Apache License 2.0
A Minimal Perfect Hash Function Library
License: Apache License 2.0
Hi, I'm not sure what's the best place to ask questions related to this project, so I hope it's ok if I create this issue to do so.
I'm wondering whether you did any performance comparisons (in regards to look-up speed) to the JDK's HashMap
. In a quick test I'm observing that HashMap
is about 8x faster for get()
than calling RecSplitEvaluator#eval()
. Does this match your expectation, too, or am I doing some stupid mistake on my end?
I'm interested as I was hoping to use MinPerf as means to optimize through-put of look-ups in immutable maps I have; but perhaps I was misguided, and actually optimizing throughput isn't a goal for MinPerf, but it's (only) optimizing for space instead? In my case, space is not so much of an issue (maps are 10K entries at most), but accessing them as efficiently as possible is desirable. Thanks a lot for clarifying!
Looking here:
Also, I have a list of parameters for different hash lengths here if you need it:
https://github.com/sh1boot/prpg/blob/e2d0a1c66359348c510819fb004b27e6f181499e/prpg.c#L104
thanks
Does this data structure retain the keys used to create it? I am searching for a perfect hash map to avoid storing millions of string keys of about 250 characters in length that map to relatively small integers. I found this one, but it seems to keep the keys and do an equality check on lookup: https://github.com/haifengl/smile/blob/f597591d0b26d14dbeaa2fdc2b70b1448ee3c564/math/src/main/java/smile/hash/PerfectHash.java.
I would like to test the minperf API but when I clone the project and open it, I have an error like Some @param values cannot be converted to target type: "CUCKOO8_4" cannot be converted to org.minperf.bloom.Filter.Type.
Please, How to solve this problem and compile the API?
I tried to execute this code and I got java.lang.ArrayIndexOutOfBoundsException
`
@org.junit.Test
public void test() {
Builder builder = new Builder();
long[] ls = new long[]{10, 20, 50};
BitBuffer bb = builder.generate(ls);
FastEvaluator evaluator = builder.evaluator(bb);
for (long l : ls) {
System.out.println(l + " -> " + evaluator.evaluate(l));
}
}`
Is there an error in my code?
This is the full exception trace :
java.lang.ArrayIndexOutOfBoundsException: 1 at org.minperf.BitBuffer.readBit(BitBuffer.java:130) at org.minperf.BitBuffer.readEliasDelta(BitBuffer.java:264) at org.minperf.hem.recsplit.FastEvaluator.<init>(FastEvaluator.java:19) at org.minperf.hem.recsplit.Builder.evaluator(Builder.java:34) at net.almightshell.experiments.Test.compareSpace(Test.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
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.