-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance improvement by using FastUtil Char2ObjectMap (concept PR) #90
base: master
Are you sure you want to change the base?
Conversation
- use primitive char - fixed warnings
Codecov Report
@@ Coverage Diff @@
## master #90 +/- ##
=============================================
- Coverage 89.56% 64.22% -25.35%
Complexity 209 209
=============================================
Files 26 28 +2
Lines 479 668 +189
Branches 66 89 +23
=============================================
Hits 429 429
- Misses 34 223 +189
Partials 16 16
Continue to review full report at Codecov.
|
The increase is size may have unforeseen consequences with applications depending on this library, such as: embedded systems, increased download times, and so forth. Fortunately, we can employ a similar strategy to how JDBC works, with the downside that it'll be a fair amount more effort. For example: import static CollectionFactory.createHashMap;
public class C {
final Map<String, String> map = createHashMap( ... );
} The default implementation would use Java's standard libraries. If an implementation exists for a drop-in replacement---fastutil, HPPC, Koloboke, or HFTC---then that library should be used through dynamic detection. In this way, if developers decide to add the dependency, then it will be used. If they don't import the dependency, then the standard JDK is used and the resulting JAR file won't explode by an extra 20MB. (ProGuard can reduce the number of bundled classes to a bare minimum, but its usage not something we can impose upon developers.) For cases where there isn't a direct 1:1 correlation (e.g., |
Thanks for the input.
|
What other ways can you see to get these performance gains that don't require developers who import this software to get a surprise 20MB increase to their own applications? Note: A PR that incurs a 10-fold increase to the final JAR size will not be accepted. |
I'm totally with you. |
I'm also checking other libraries: |
Description
Suggestion for performance improvement by using FastUtil Char2ObjectMap, specialized char map implementation.
Changes
Observed results
Benchmark result raw files
bench-post.2.txt
bench-post.csv.txt
bench-post.txt
bench-pre.2.txt
bench-pre.csv.txt
bench-pre.txt
Down sides
fastutil dependecy is pretty big, benchmark fat jar is 21M after adding it, prior to that it was about 2.4M
Reference
#31