Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitffc7f14

Browse files
authored
Inline stage 1 (#53)
1 parentd8a3ef6 commitffc7f14

File tree

36 files changed

+1444
-1447
lines changed

36 files changed

+1444
-1447
lines changed

‎build.gradle‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,20 @@ jmh {
136136
jvmArgsPrepend= [
137137
'--add-modules=jdk.incubator.vector'
138138
]
139-
if (getBooleanProperty('jmh.profilersEnabled',false)) {
140-
createDirIfDoesNotExist('./profilers')
141-
if (OperatingSystem.current().isLinux()) {
142-
def profilerList= [
143-
'async:verbose=true;output=flamegraph;event=cpu;dir=./profilers/async;libPath='+ getLibPath('LD_LIBRARY_PATH')
144-
]
145-
if (getBooleanProperty('jmh.jitLogEnabled',false)) {
146-
createDirIfDoesNotExist('./profilers/perfasm')
147-
profilerList+= [
148-
'perfasm:intelSyntax=true;saveLog=true;saveLogTo=./profilers/perfasm'
149-
]
150-
}
151-
profilers= profilerList
152-
}elseif (OperatingSystem.current().isMacOsX()) {
153-
profilers= [
154-
'async:verbose=true;output=flamegraph;event=cpu;dir=./profilers/async;libPath='+ getLibPath('DYLD_LIBRARY_PATH')
155-
]
139+
if (OperatingSystem.current().isLinux()) {
140+
def profilerList= []
141+
if (getBooleanProperty('jmh.asyncProfilerEnabled',false)) {
142+
createDirIfDoesNotExist('./profilers/async')
143+
profilerList+= ['async:verbose=true;output=flamegraph;event=cpu;dir=./profilers/async;libPath='+ getLibPath('LD_LIBRARY_PATH')]
144+
}
145+
if (getBooleanProperty('jmh.perfAsmEnabled',false)) {
146+
createDirIfDoesNotExist('./profilers/perfasm')
147+
profilerList+= ['perfasm:intelSyntax=true;saveLog=true;saveLogTo=./profilers/perfasm']
148+
}
149+
if (getBooleanProperty('jmh.perfEnabled',false)) {
150+
profilerList+= ['perf']
156151
}
152+
profilers= profilerList
157153
}
158154
if (project.hasProperty('jmh.includes')) {
159155
includes= [project.findProperty('jmh.includes')]

‎src/jmh/java/org/simdjson/ParseAndSelectBenchmark.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void setup() throws IOException {
3939
buffer =is.readAllBytes();
4040
bufferPadded =padded(buffer);
4141
}
42-
System.out.println("VectorSpecies = " +StructuralIndexer.BYTE_SPECIES);
42+
System.out.println("VectorSpecies = " +VectorUtils.BYTE_SPECIES);
4343
}
4444

4545
@Benchmark

‎src/jmh/java/org/simdjson/SchemaBasedParseAndSelectBenchmark.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void setup() throws IOException {
4141
buffer =is.readAllBytes();
4242
bufferPadded =padded(buffer);
4343
}
44-
System.out.println("VectorSpecies = " +StructuralIndexer.BYTE_SPECIES);
44+
System.out.println("VectorSpecies = " +VectorUtils.BYTE_SPECIES);
4545
}
4646

4747
@Benchmark

‎src/jmh/java/org/simdjson/Utf8ValidatorBenchmark.java‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
packageorg.simdjson;
22

33
importcom.google.common.base.Utf8;
4-
importorg.openjdk.jmh.annotations.*;
4+
importorg.openjdk.jmh.annotations.Benchmark;
5+
importorg.openjdk.jmh.annotations.BenchmarkMode;
6+
importorg.openjdk.jmh.annotations.Level;
7+
importorg.openjdk.jmh.annotations.Mode;
8+
importorg.openjdk.jmh.annotations.OutputTimeUnit;
9+
importorg.openjdk.jmh.annotations.Param;
10+
importorg.openjdk.jmh.annotations.Scope;
11+
importorg.openjdk.jmh.annotations.Setup;
12+
importorg.openjdk.jmh.annotations.State;
513

614
importjava.io.IOException;
715
importjava.io.InputStream;
@@ -11,6 +19,7 @@
1119
@BenchmarkMode(Mode.Throughput)
1220
@OutputTimeUnit(TimeUnit.SECONDS)
1321
publicclassUtf8ValidatorBenchmark {
22+
1423
@Param({"/twitter.json","/gsoc-2018.json","/github_events.json"})
1524
StringfileName;
1625
byte[]bytes;
@@ -24,7 +33,7 @@ public void setup() throws IOException {
2433

2534
@Benchmark
2635
publicvoidutf8Validator() {
27-
Utf8Validator.validate(bytes);
36+
Utf8Validator.validate(bytes,bytes.length);
2837
}
2938

3039
@Benchmark

‎src/main/java/org/simdjson/BlockReader.java‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎src/main/java/org/simdjson/CharactersClassifier.java‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

‎src/main/java/org/simdjson/JsonCharacterBlock.java‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎src/main/java/org/simdjson/JsonStringBlock.java‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/main/java/org/simdjson/JsonStringScanner.java‎

Lines changed: 0 additions & 90 deletions
This file was deleted.

‎src/main/java/org/simdjson/SimdJsonParser.java‎

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
publicclassSimdJsonParser {
44

5-
privatestaticfinalintSTEP_SIZE =64;
65
privatestaticfinalintPADDING =64;
76
privatestaticfinalintDEFAULT_CAPACITY =34 *1024 *1024;// we should be able to handle jsons <= 34MiB
87
privatestaticfinalintDEFAULT_MAX_DEPTH =1024;
98

10-
privatefinalBlockReaderreader;
119
privatefinalStructuralIndexerindexer;
1210
privatefinalBitIndexesbitIndexes;
1311
privatefinalJsonIteratorjsonIterator;
@@ -24,23 +22,20 @@ public SimdJsonParser(int capacity, int maxDepth) {
2422
jsonIterator =newJsonIterator(bitIndexes,stringBuffer,capacity,maxDepth,PADDING);
2523
schemaBasedJsonIterator =newSchemaBasedJsonIterator(bitIndexes,stringBuffer,PADDING);
2624
paddedBuffer =newbyte[capacity];
27-
reader =newBlockReader(STEP_SIZE);
2825
indexer =newStructuralIndexer(bitIndexes);
2926
}
3027

3128
public <T>Tparse(byte[]buffer,intlen,Class<T>expectedType) {
32-
stage0(buffer);
3329
byte[]padded =padIfNeeded(buffer,len);
34-
reset(padded,len);
35-
stage1(padded);
30+
reset();
31+
stage1(padded,len);
3632
returnschemaBasedJsonIterator.walkDocument(padded,len,expectedType);
3733
}
3834

3935
publicJsonValueparse(byte[]buffer,intlen) {
40-
stage0(buffer);
4136
byte[]padded =padIfNeeded(buffer,len);
42-
reset(padded,len);
43-
stage1(padded);
37+
reset();
38+
stage1(padded,len);
4439
returnjsonIterator.walkDocument(padded,len);
4540
}
4641

@@ -52,25 +47,13 @@ private byte[] padIfNeeded(byte[] buffer, int len) {
5247
returnbuffer;
5348
}
5449

55-
privatevoidreset(byte[]buffer,intlen) {
56-
indexer.reset();
57-
reader.reset(buffer,len);
50+
privatevoidreset() {
5851
bitIndexes.reset();
5952
jsonIterator.reset();
6053
}
6154

62-
privatevoidstage0(byte[]buffer) {
63-
Utf8Validator.validate(buffer);
64-
}
65-
66-
privatevoidstage1(byte[]buffer) {
67-
while (reader.hasFullBlock()) {
68-
intblockIndex =reader.getBlockIndex();
69-
indexer.step(buffer,blockIndex,blockIndex);
70-
reader.advance();
71-
}
72-
indexer.step(reader.remainder(),0,reader.getBlockIndex());
73-
reader.advance();
74-
indexer.finish(reader.getBlockIndex());
55+
privatevoidstage1(byte[]buffer,intlength) {
56+
Utf8Validator.validate(buffer,length);
57+
indexer.index(buffer,length);
7558
}
7659
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp