pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/jruby/jruby/pull/9176/files

" href="https://github.githubassets.com/assets/primer-primitives-10bf9dd67e3d70bd.css" /> Experiment to use hash4j algorithms for String#hash by headius · Pull Request #9176 · jruby/jruby · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@

jar 'org.crac:crac:1.5.0'

jar 'com.dynatrace.hash4j:hash4j:0.29.0'

plugin_management do
plugin('org.eclipse.m2e:lifecycle-mapping:1.0.0',
lifecycleMappingMetadata: {
Expand Down
5 changes: 5 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ DO NOT MODIFY - GENERATED CODE
<artifactId>crac</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.dynatrace.hash4j</groupId>
<artifactId>hash4j</artifactId>
<version>0.29.0</version>
</dependency>
</dependencies>
<build>
<defaultGoal>package</defaultGoal>
Expand Down
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

package org.jruby;

import com.dynatrace.hash4j.hashing.Hasher64;
import com.dynatrace.hash4j.hashing.Hashing;
import jnr.posix.POSIX;

import org.jcodings.Config;
Expand Down Expand Up @@ -171,6 +173,7 @@ public class RubyString extends RubyObject implements CharSequence, EncodingCapa
// Follow-up work should reevaluate this value (Currently only explicit capacity to initialize is using
// this value).
private static final int STRING_MINIMUM_SIZE = 4;
private static final Hasher64 RAPIDHASHER = Hashing.rapidhash3(Ruby.getHashSeed0());

public static RubyString[] NULL_ARRAY = {};

Expand Down Expand Up @@ -1583,8 +1586,9 @@ public int strHashCode(Ruby runtime) {
Ruby.getHashSeed1(), value.getUnsafeBytes(), value.getBegin(),
value.getRealSize());
} else {
hash = PerlHash.hash(Ruby.getHashSeed0(),
value.getUnsafeBytes(), value.getBegin(), value.getRealSize());
// hash = PerlHash.hash(Ruby.getHashSeed0(),
// value.getUnsafeBytes(), value.getBegin(), value.getRealSize());
hash = RAPIDHASHER.hashBytesToLong(value.getUnsafeBytes(), value.getBegin(), value.getRealSize());
}
hash ^= (enc.isAsciiCompatible() && scanForCodeRange() == CR_7BIT ? 0 : enc.getIndex());
return (int) hash;
Expand Down
3 changes: 3 additions & 0 deletions shaded/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
'Enable-Native-Access' => 'ALL-UNNAMED',
}
}],
filters: [
{ artifact: 'com.dynatrace.hash4j:hash4j', excludes: '**/25/**' },
],
createSourcesJar: false,
compress: false)
end
Expand Down
6 changes: 6 additions & 0 deletions shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ DO NOT MODIFY - GENERATED CODE
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>com.dynatrace.hash4j:hash4j</artifact>
<excludes>**/25/**</excludes>
</filter>
</filters>
<createSourcesJar>false</createSourcesJar>
<compress>false</compress>
</configuration>
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy