Skip to content
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

Optimization of Long boxing in the PackedLongHashSet #137

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

semoro
Copy link

@semoro semoro commented Apr 19, 2024

What does this PR do?

Optimization of Long boxing in the PackedLongHashSet

The optimization is based on the boxing elimination, now PackedLongHashSet.contains directly uses the performant getEntry(long) method thus avoiding the boxing and associated allocations

Before:

Benchmark                                                  Mode  Cnt   Score   Error   Units
dataStructures.JMHPackedLongHashSetBenchmark.tryContains  thrpt   30  14,195 ± 1,574  ops/ms

After:

Benchmark                                                  Mode  Cnt   Score   Error   Units
dataStructures.JMHPackedLongHashSetBenchmark.tryContains  thrpt   30  46,406 ± 1,430  ops/ms

Checklist

[x] I have added unit tests to the code I am submitting
[x] My unit tests cover both failure and success scenarios
[x] If applicable, I have discussed my architecture

The optimization is based on the boxing elimination, now `PackedLongHashSet.contains` directly uses the performant `getEntry(long)` method thus avoiding the boxing and associated allocations

Before:
```
Benchmark                                                  Mode  Cnt   Score   Error   Units
dataStructures.JMHPackedLongHashSetBenchmark.tryContains  thrpt   30  14,195 ± 1,574  ops/ms
```

After:
```
Benchmark                                                  Mode  Cnt   Score   Error   Units
dataStructures.JMHPackedLongHashSetBenchmark.tryContains  thrpt   30  46,406 ± 1,430  ops/ms
```
@semoro semoro changed the base branch from master to release-3.1 April 19, 2024 09:47
@andrii0lomakin andrii0lomakin merged commit 3a73782 into JetBrains:release-3.1 Apr 19, 2024
1 check passed
jk1 pushed a commit that referenced this pull request Apr 26, 2024
The optimization is based on the boxing elimination, now `PackedLongHashSet.contains` directly uses the performant `getEntry(long)` method thus avoiding the boxing and associated allocations

Before:
```
Benchmark                                                  Mode  Cnt   Score   Error   Units
dataStructures.JMHPackedLongHashSetBenchmark.tryContains  thrpt   30  14,195 ± 1,574  ops/ms
```

After:
```
Benchmark                                                  Mode  Cnt   Score   Error   Units
dataStructures.JMHPackedLongHashSetBenchmark.tryContains  thrpt   30  46,406 ± 1,430  ops/ms
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants