Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 4e99019

Browse files
authored
Adds test of validate performance (#295)
1 parent 86a195a commit 4e99019

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

samples/client/petstore/java/src/test/java/org/openapijsonschematools/schemas/ArrayTypeSchemaTest.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,54 @@ public void testValidateArrayWithOutputClsSchema() {
113113
finalInList, configuration
114114
));
115115
}
116+
117+
// @Test
118+
// public void testValidateList() {
119+
// int schemaQty = 1000;
120+
// List<Object> inList = new ArrayList<>(schemaQty-1);
121+
// Long loops = 100L;
122+
// Double mSecPerSchemaMax = null;
123+
// Double mSecPerSchemaMin = null;
124+
// Double mSecPerSchemaTotal = 0d;
125+
// int loop = loops.intValue();
126+
// while (loop > 0) {
127+
// int i = 0;
128+
// while (i < schemaQty) {
129+
// inList.add(i, "a");
130+
// i += 1;
131+
// }
132+
// long start = System.currentTimeMillis();
133+
// FrozenList<Object> validatedValue = ArrayWithItemsSchema.validate(inList, configuration);
134+
// long finish = System.currentTimeMillis();
135+
// long timeElapsed = finish - start;
136+
// double mSecPerSchema = Double.longBitsToDouble (timeElapsed) / Double.longBitsToDouble(schemaQty);
137+
// mSecPerSchemaTotal += mSecPerSchema;
138+
// if (mSecPerSchemaMax == null) {
139+
// mSecPerSchemaMax = mSecPerSchema;
140+
// } else if (mSecPerSchemaMax < mSecPerSchema) {
141+
// mSecPerSchemaMax = mSecPerSchema;
142+
// }
143+
// if (mSecPerSchemaMin == null) {
144+
// mSecPerSchemaMin = mSecPerSchema;
145+
// } else if (mSecPerSchema < mSecPerSchemaMin) {
146+
// mSecPerSchemaMin = mSecPerSchema;
147+
// }
148+
// loop -= 1;
149+
// }
150+
// System.Logger logger = System.getLogger("");
151+
// logger.log(System.Logger.Level.INFO, "loops "+loops);
152+
// logger.log(System.Logger.Level.INFO, "mSecPerSchemaMax "+mSecPerSchemaMax);
153+
// logger.log(System.Logger.Level.INFO, "mSecPerSchemaMin "+mSecPerSchemaMin);
154+
// logger.log(System.Logger.Level.INFO, "mSecPerSchemaTotal "+mSecPerSchemaTotal);
155+
// double mSecPerSchemaAvg = mSecPerSchemaTotal / loops.doubleValue();
156+
// /*
157+
// 100 loop, max 0.732, min 0.042, avg 0.183 msec per schema
158+
// 100 loop, max 1.008, min 0.088, avg 0.314 msec per schema
159+
// 100 loop, max 1.192, min 0.041, avg 0.283 msec per schema
160+
// 100 loop, max 0.779, min 0.062, avg 0.270 msec per schema
161+
// 100 loop, max 1.167, min 0.052, avg 0.292 msec per schema
162+
// */
163+
// logger.log(System.Logger.Level.INFO, "mSecPerSchemaAvg "+mSecPerSchemaAvg);
164+
// Assert.assertEquals(mSecPerSchemaAvg, 0d, 0.0000001);
165+
// }
116166
}

0 commit comments

Comments
 (0)