-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Map<Long, Object> by primitive LongObjectHashMap. (#13392)
Add LongObjectHashMap and replace Map<Long, Object>. Add LongIntHashMap and replace Map<Long, Int>. Add HPPC dependency to join and spatial modules for primitive values float and double.
- Loading branch information
1 parent
f07038d
commit 816db79
Showing
26 changed files
with
3,280 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
lucene/core/src/java/org/apache/lucene/util/hppc/HashContainers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.lucene.util.hppc; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
/** Constants for primitive maps. */ | ||
public class HashContainers { | ||
|
||
public static final int DEFAULT_EXPECTED_ELEMENTS = 4; | ||
|
||
public static final float DEFAULT_LOAD_FACTOR = 0.75f; | ||
|
||
/** Minimal sane load factor (99 empty slots per 100). */ | ||
public static final float MIN_LOAD_FACTOR = 1 / 100.0f; | ||
|
||
/** Maximum sane load factor (1 empty slot per 100). */ | ||
public static final float MAX_LOAD_FACTOR = 99 / 100.0f; | ||
|
||
/** Minimum hash buffer size. */ | ||
public static final int MIN_HASH_ARRAY_LENGTH = 4; | ||
|
||
/** | ||
* Maximum array size for hash containers (power-of-two and still allocable in Java, not a | ||
* negative int). | ||
*/ | ||
public static final int MAX_HASH_ARRAY_LENGTH = 0x80000000 >>> 1; | ||
|
||
static final AtomicInteger ITERATION_SEED = new AtomicInteger(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
lucene/core/src/java/org/apache/lucene/util/hppc/LongCursor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.lucene.util.hppc; | ||
|
||
/** Forked from HPPC, holding int index and long value */ | ||
public final class LongCursor { | ||
/** | ||
* The current value's index in the container this cursor belongs to. The meaning of this index is | ||
* defined by the container (usually it will be an index in the underlying storage buffer). | ||
*/ | ||
public int index; | ||
|
||
/** The current value. */ | ||
public long value; | ||
|
||
@Override | ||
public String toString() { | ||
return "[cursor, index: " + index + ", value: " + value + "]"; | ||
} | ||
} |
Oops, something went wrong.