use of org.trie4j.test.LapTimer in project trie4j by takawitter.
the class AbstractSetWikipediaSerializeTest method test.
@SuppressWarnings("unchecked")
@Test
public void test() throws Exception {
WikipediaTitles wt = new WikipediaTitles();
Set<String> set = wt.insertTo(set());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
LapTimer lt = new LapTimer();
oos.writeObject(set);
oos.flush();
long wd = lt.lapMillis();
byte[] serialized = baos.toByteArray();
lt.reset();
Set<String> t = (Set<String>) new ObjectInputStream(new ByteArrayInputStream(serialized)).readObject();
long rd = lt.lapMillis();
long vd = wt.assertAllContains(t);
System.out.println(String.format("%s%s, size: %d, write(ms): %d, read(ms): %d, verify(ms): %d.", set.getClass().getSimpleName(), "", serialized.length, wd, rd, vd));
}
Aggregations