This file contains hidden or 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
package org.antlr.v4.runtime.misc; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.antlr.v4.runtime.dfa.DFAState; | |
public class DFAStateEdgeCache { | |
private static final int DEFAULT_INITIAL_CAPACITY = 4; |
This file contains hidden or 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
package org.antlr.v4.runtime.misc; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicReference; | |
import org.antlr.v4.runtime.dfa.DFAState; | |
public class DFAStateEdgeCache { |
This file contains hidden or 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
package zemberek.core.collections; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* A simple hashmap with integer keys and T values. | |
* implements open address linear probing algorithm. | |
* <p> |
This file contains hidden or 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
// Simple histogram | |
private static class Histogram { | |
static int[] DEFAULT_HISTOGRAM_BUCKETS = | |
{0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 32, 64, 100, 200, 500, 1000, 10000, Integer.MAX_VALUE}; | |
int[] buckets; | |
int[] counts; | |
double[] percents; | |
long total; |
This file contains hidden or 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
package foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Random; | |
public class Main { | |
public static void main(String[] args) { |
This file contains hidden or 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
package foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* A map like class that has integer keys and T values. Relatively fast and | |
* compact compared to default HashMap. | |
* |
This file contains hidden or 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
package foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* A map like class that has integer keys and T values. Relatively fast and | |
* compact compared to default HashMap. Implementation is open address | |
* linear probing with some heuristics on expansion limits. |
This file contains hidden or 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
package foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.List; | |
/** | |
* A map like structure that has unsigned integer keys and T values. | |
* |
This file contains hidden or 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
package foo; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.List; | |
/** | |
* A map like structure that has unsigned integer keys and T values. | |
* |
This file contains hidden or 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
Benchmark system: | |
Ryzen 1700+ 3.4Ghz, 32GB Ram, 1 TB Samsung 960 Evo NVMe | |
Input Text: ~50MB Turkish text from a news site, | |
Total chars: 45,430,066 Ascii: 41,465,690 | |
Ascii Percent: 91.27% | |
Base Antlr (128 slot static lookup table, slow path for rest) | |
Total tokens:12103250 | |
Total time: 13741ms. |
NewerOlder