Comments (5)
for smaller than 64 bit hashes we could also fall back to long variables and do primitive bit shifting.
from jimagehash.
jmh benchmarks.
Big Integer is the current implementation. Performance decreases with increased hash length
Benchmark | Mode | Cnt | Score | Error | Units |
---|---|---|---|---|---|
kilianB.HashCreationBenchmark.benchmarkAverageHash32BigInteger | thrpt | 25 | 152626,545 | ± 2741,163 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash32BigIntegerStringBuilder | thrpt | 25 | 158690,519 | ± 2111,147 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash32MutableBigInteger | thrpt | 25 | 157546,217 | ± 2026,677 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash128BigInteger | thrpt | 25 | 104932,391 | ± 1387,338 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash128BigIntegerStringBuilder | thrpt | 25 | 117392,216 | ± 1035,051 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash128MutableBigInteger | thrpt | 25 | 116409,836 | ± 2436,276 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash5000BigInteger | thrpt | 25 | 1387,469 | ± 6,534 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash5000BigIntegerStringBuilder | thrpt | 25 | 7690,280 | ± 96,870 | ops/s |
kilianB.HashCreationBenchmark.benchmarkAverageHash5000MutableBigInteger | thrpt | 25 | 7715,949 | ± 49,220 | ops/s |
Mutable big integer requires method handles and reflection access which is not warranted for the performance difference compare to the stringbuilder approach (as well as unit tests to guarantee that the implementation is working as expected).
A new StringBuilder is created for every hash creation. Caching a stringbuilder would result again in a performance gain at the cost of thread safety. In relation file IO is much more heavy and the treadoff isn't worth it.
Migration to either stringbuilder or mutable big int allows to cut the first pass needed to estimate the hash length on an algorithm basis
from jimagehash.
fixed with afc026d
from jimagehash.
Using a custom hash builder which manipulates a byte array directly we can gain even more performance d9ef1f8
Now even the 5000 bit hash runs with 13.000 hashes created / second up from 1.3 k
from jimagehash.
fixed with v 3.0.0
from jimagehash.
Related Issues (20)
- Comparing different size image HOT 2
- Logging HOT 1
- Can we using pHash without convert to greyscale color
- Can't Find MathUtil or ArrayUtil HOT 1
- Problems with equals method HOT 5
- Can I use It in android? HOT 4
- RotAverageHash returns the different results for the same object HOT 1
- Synk reports vulnerability for h2 dependency
- JRE 1.8? HOT 4
- i love it so much!
- Android Usage HOT 2
- Question: Image Hash vs Image Feature Descriptor
- Crop-Resistent Hash
- Parity with Python HOT 3
- Hash class to implement Compareable
- Another Good Image Hash Method HOT 4
- Cannot find dependencies HOT 3
- Can h2database be replaced with mysql?
- Can this be built with Java 17? Do you see a issue with that? HOT 1
- Attempting to recreate tables that already exist with DatabaseMatcher HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jimagehash.