public static void testSpeed(boolean isBWT)
    {
         System.out.println("\nBWT"+(!isBWT?"S":"")+" Speed test");
         int iter = 2000;
         int size = 256*1024;
         byte[] buf1 = new byte[size];
         byte[] buf2 = new byte[size];
         byte[] buf3 = new byte[size];
         SliceByteArray sa1 = new SliceByteArray(buf1, 0);
         SliceByteArray sa2 = new SliceByteArray(buf2, 0);
         SliceByteArray sa3 = new SliceByteArray(buf3, 0);
         System.out.println("Iterations: "+iter);
         System.out.println("Transform size: "+size);

         for (int jj = 0; jj < 3; jj++)
         {
             long delta1 = 0;
             long delta2 = 0;
             ByteTransform bwt = (isBWT) ? new BWT() : new BWTS();
             java.util.Random random = new java.util.Random();
             long before, after;

             for (int ii = 0; ii < iter; ii++)
             {
                 for (int i = 0; i < size; i++)
                     buf1[i] = (byte) (random.nextInt(255) + 1);

                 before = System.nanoTime();
                 sa1.index = 0;
                 sa2.index = 0;
                 bwt.forward(sa1, sa2);
                 after = System.nanoTime();
                 delta1 += (after - before);
                 before = System.nanoTime();
                 sa2.index = 0;
                 sa3.index = 0;
                 bwt.inverse(sa2, sa3);
                 after = System.nanoTime();
                 delta2 += (after - before);
             
               int idx = -1;

               // Sanity check
               for (int i=0; i<size; i++)
               {
                  if (buf1[i] != buf3[i])
                  {
                     idx = i;
                     break;
                  }
               }

               if (idx >= 0)
                  System.out.println("Failure at index "+idx+" ("+buf1[idx]+"<->"+buf3[idx]+")");             
             }

            final long prod = (long) iter * (long) size;
            System.out.println("Forward transform [ms] : " + delta1 / 1000000);
            System.out.println("Throughput [KB/s]      : " + prod * 1000000L / delta1 * 1000L / 1024);
            System.out.println("Inverse transform [ms] : " + delta2 / 1000000);
            System.out.println("Throughput [KB/s]      : " + prod * 1000000L / delta2 * 1000L / 1024);
         }
    }