Skip to content
Snippets Groups Projects
Commit 2a727e3c authored by Mamadu-lamarana Bah's avatar Mamadu-lamarana Bah :speech_balloon:
Browse files

suppression de la fonction de timeBagOfPrimitivesStreaming

parent ac838b88
No related branches found
No related tags found
No related merge requests found
......@@ -50,36 +50,7 @@ public class BagOfPrimitivesDeserializationBenchmark {
gson.fromJson(json, BagOfPrimitives.class);
}
}
/** Benchmark to measure deserializing objects by hand */
public void timeBagOfPrimitivesStreaming(int reps) throws IOException {
for (int i = 0; i < reps; ++i) {
StringReader reader = new StringReader(json);
JsonReader jr = new JsonReader(reader);
jr.beginObject();
long longValue = 0;
int intValue = 0;
boolean booleanValue = false;
String stringValue = null;
while (jr.hasNext()) {
String name = jr.nextName();
if (name.equals("longValue")) {
longValue = jr.nextLong();
} else if (name.equals("intValue")) {
intValue = jr.nextInt();
} else if (name.equals("booleanValue")) {
booleanValue = jr.nextBoolean();
} else if (name.equals("stringValue")) {
stringValue = jr.nextString();
} else {
throw new IOException("Unexpected name: " + name);
}
}
jr.endObject();
new BagOfPrimitives(longValue, intValue, booleanValue, stringValue);
}
}
/**
* This benchmark measures the ideal Gson performance: the cost of parsing a JSON stream and
* setting object values by reflection. We should strive to reduce the discrepancy between this
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment