@@ -0,0 +1,2485 @@
+package org.apache.uima.cas.impl;%0D%0A%0D%0Aimport java.io.BufferedInputStream;%0D%0Aimport java.io.ByteArrayOutputStream;%0D%0Aimport java.io.File;%0D%0Aimport java.io.FileInputStream;%0D%0Aimport java.io.IOException;%0D%0Aimport java.io.InputStream;%0D%0A%0D%0Aimport org.apache.uima.UIMAFramework;%0D%0Aimport org.apache.uima.cas.CAS;%0D%0Aimport org.apache.uima.resource.metadata.TypeSystemDescription;%0D%0Aimport org.apache.uima.util.CasCreationUtils;%0D%0Aimport org.apache.uima.util.XMLInputSource;%0D%0A%0D%0Aimport junit.framework.TestCase;%0D%0A%0D%0Apublic class BinaryCasSerDesPerformance extends TestCase %7B%0D%0A%0D%0A  // Note: This test case requires an input directory that has%0D%0A  //   1) a file typesystem.xml which has the type system for the serialized files%0D%0A  //   2) a bunch of files having compressed serialized CASes%0D%0A  //   Set the directory in the 2nd line below%0D%0A  public void testBinaryCasDeserialization6Performance() throws Exception %7B%0D%0A    %0D%0A    File dir = new File(%22%22 /*%22/au/t/data/bin-compr-6/shakespeare.txt_40_processed%22*/);%0D%0A    %0D%0A    if (!dir.exists()) return;%0D%0A    %0D%0A    File typeSystemFile = new File(dir, %22typesystem.xml%22);%0D%0A    XMLInputSource in = new XMLInputSource(typeSystemFile);%0D%0A    TypeSystemDescription typeSystemDescription = UIMAFramework.getXMLParser().parseTypeSystemDescription(in);%0D%0A    CAS cas = CasCreationUtils.createCas(typeSystemDescription, null, null);%0D%0A    %0D%0A    long accumDeser = 0;%0D%0A    long accumSer = 0;%0D%0A    for (int i = 0; i %3C10; i++) %7B%0D%0A    for (final File f : dir.listFiles()) %7B%0D%0A      if (f.getName().equals(%22typesystem.xml%22)) %7B%0D%0A        continue;%0D%0A      %7D%0D%0A      InputStream inputStream = new BufferedInputStream(new FileInputStream(f));%0D%0A      cas.reset();%0D%0A      long ist = System.nanoTime();%0D%0A      Serialization.deserializeCAS(cas, inputStream);%0D%0A      accumDeser += System.nanoTime() - ist;  %0D%0A      %0D%0A      ByteArrayOutputStream baos = new ByteArrayOutputStream(1024*512);%0D%0A      ist = System.nanoTime();%0D%0A      Serialization.serializeWithCompression(cas, baos, cas.getTypeSystem());%0D%0A      accumSer += System.nanoTime() - ist;%0D%0A//      System.out.format(%22Time to deserialize was %25,d milliseconds, size = %25d%25n%22, %0D%0A//          (System.nanoTime() - ist) / 1000000L, ((CASImpl)cas).getHeap().getHeapSize());%0D%0A    %7D%0D%0A    %7D%0D%0A    System.out.format(%22Time to deserialize all files was %25,d milliseconds%25n%22, accumDeser / 1000000); // (System.nanoTime() - startTime) / 1000000L);%0D%0A    System.out.format(%22Time to serialize   all files was %25,d milliseconds%25n%22, accumSer / 1000000);%0D%0A  %7D%0D%0A%0D%0A%7D%0D%0A

add a performance test driver to test cases - it's disabled but can be enabled when tuning measurements are wanted, by providing a directory somewhere of CASs to deserialize.