fixed bug in Leb128 serialization

This commit is contained in:
2019-09-01 23:56:18 +01:00
parent 50089fa6f8
commit 39d6c7ced6
7 changed files with 49 additions and 19 deletions

View File

@@ -6,6 +6,8 @@ import lombok.SneakyThrows;
import net.woggioni.worth.antlr.JSONLexer;
import net.woggioni.worth.antlr.JSONListenerImpl;
import net.woggioni.worth.serialization.binary.JBONDumper;
import net.woggioni.worth.serialization.binary.JBONParser;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Dumper;
import net.woggioni.worth.xface.Parser;
import net.woggioni.worth.xface.Value;
@@ -31,6 +33,11 @@ public class PerformanceTest {
return new XZInputStream(new BufferedInputStream(PerformanceTest.class.getResourceAsStream("/citylots.json.xz")));
}
@SneakyThrows
private static InputStream extractBinaryTestData() {
return new XZInputStream(new BufferedInputStream(PerformanceTest.class.getResourceAsStream("/citylots.jbon.xz")));
}
private static InputStream smallTestData() {
return new BufferedInputStream(PerformanceTest.class.getResourceAsStream("/wordpress.json"));
}
@@ -95,6 +102,9 @@ public class PerformanceTest {
public void hugeJSONTest() {
double jacksonTime, worthTime, antlrTime;
Chronometer chr = new Chronometer();
Value.Configuration cfg = Value.Configuration.builder()
.objectValueImplementation(ObjectValue.Implementation.ArrayList)
.build();
try(InputStream is = extractTestData()) {
chr.reset();
ObjectMapper om = new ObjectMapper();
@@ -104,10 +114,18 @@ public class PerformanceTest {
}
try(InputStream is = extractTestData()) {
chr.reset();
new JSONParser().parse(is);
new JSONParser(cfg).parse(is);
worthTime = chr.stop(Chronometer.TimeUnit.SECOND);
System.out.printf("Worth time: %8s sec\n", String.format("%.3f", worthTime));
}
try(InputStream is = extractBinaryTestData()) {
chr.reset();
new JBONParser(cfg).parse(is);
worthTime = chr.stop(Chronometer.TimeUnit.SECOND);
System.out.printf("Worth time binary: %8s sec\n", String.format("%.3f", worthTime));
}
try(InputStream is = extractTestData()) {
chr.reset();
CharStream inputStream = CharStreams.fromReader(new InputStreamReader(is));