Skip to content

Add new data structures#715

Closed
bchapuis wants to merge 14 commits intomainfrom
681-handle-the-out-of-memory-errors
Closed

Add new data structures#715
bchapuis wants to merge 14 commits intomainfrom
681-handle-the-out-of-memory-errors

Conversation

@bchapuis
Copy link
Member

@bchapuis bchapuis commented Jul 4, 2023

This pull request adds a jagged data structure and several open hash data structures derived from fastutil.

The open hash data structure have performence similar to the monotonic data structures. They probably use more space, but they relax the ordering constraint when inserting entries. Some of the features (e.g. rehashing) have not be extensively tested, but this is not something we need right now (i.e. we are usually able to guess the number of entries in advance).

@bchapuis bchapuis linked an issue Jul 4, 2023 that may be closed by this pull request
@bchapuis bchapuis force-pushed the 681-handle-the-out-of-memory-errors branch from beb3b3c to b7bbc1c Compare July 4, 2023 21:12
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@bchapuis bchapuis force-pushed the 681-handle-the-out-of-memory-errors branch 3 times, most recently from 682b70b to 5492e0c Compare July 12, 2023 13:34
* {@inheritDoc}
*/
@Override
public long computeIfAbsent(final long key, final Long2LongFunction mappingFunction) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods

Method Long2LongOpenHashDataMap.computeIfAbsent(..) could be confused with overloaded method [computeIfAbsent](1), since dispatch depends on static types.
* {@inheritDoc}
*/
@Override
public long computeIfAbsent(final long key, final Long2LongFunction mappingFunction) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods

Method Long2LongPackedOpenHashDataMap.computeIfAbsent(..) could be confused with overloaded method [computeIfAbsent](1), since dispatch depends on static types.
* {@inheritDoc}
*/
@Override
public V computeIfAbsent(final long key, final Long2ObjectFunction<? extends V> mappingFunction) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods

Method Long2ObjectOpenHashDataMap.computeIfAbsent(..) could be confused with overloaded method [computeIfAbsent](1), since dispatch depends on static types.
public Set<Entry<Long, E>> entrySet() {
return new EntrySet();
default List<E> getAll(List<Long> keys) {
return Streams.stream(keys).map(this::get).toList();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [Streams.stream](1) should be avoided because it has been deprecated.
if (wrapped == null) {
wrapped = new LongArrayList(2);
}
wrapped.add(pair.left());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AbstractLongCollection.add](1) should be avoided because it has been deprecated.
if (wrapped == null) {
wrapped = new LongArrayList(2);
}
wrapped.add(key.get(pos));

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AbstractLongCollection.add](1) should be avoided because it has been deprecated.
if (wrapped == null) {
wrapped = new LongArrayList(2);
}
wrapped.add(key.get(pos));

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AbstractLongCollection.add](1) should be avoided because it has been deprecated.
@bchapuis bchapuis force-pushed the 681-handle-the-out-of-memory-errors branch 2 times, most recently from a15380f to c26d539 Compare July 12, 2023 23:17
@bchapuis bchapuis marked this pull request as ready for review July 13, 2023 11:35
@bchapuis bchapuis requested a review from leonardcser July 13, 2023 11:40
Copy link
Contributor

@leonardcser leonardcser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great additions!

* @deprecated Please use the corresponding type-specific method instead.
*/
@Override
public Long setValue(final Long v) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods

Method MapEntry.setValue(..) could be confused with overloaded method [setValue](1), since dispatch depends on static types.
* @deprecated Please use the corresponding type-specific method instead.
*/
@Override
public Long setValue(final Long v) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods

Method MapEntry.setValue(..) could be confused with overloaded method [setValue](1), since dispatch depends on static types.
@bchapuis bchapuis force-pushed the 681-handle-the-out-of-memory-errors branch from d325035 to dca3ce4 Compare July 31, 2023 20:49
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug E 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 203 Code Smells

No Coverage information No Coverage information
26.8% 26.8% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@bchapuis bchapuis closed this Aug 10, 2023
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.

Handle the Out of Memory Errors

2 participants