コード例 #1
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.TypeLoadException"/>
        internal static ConcatVectorBenchmark.SerializationReport ProtoSerializationBenchmark(ConcatVectorBenchmark.ConcatVectorConstructionRecord[] records)
        {
            ConcatVector[]        vectors = MakeVectors(records);
            ByteArrayOutputStream bArr    = new ByteArrayOutputStream();
            long before = Runtime.CurrentTimeMillis();

            for (int i = 0; i < vectors.Length; i++)
            {
                vectors[i].WriteToStream(bArr);
            }
            bArr.Close();
            byte[] bytes = bArr.ToByteArray();
            ByteArrayInputStream bArrIn = new ByteArrayInputStream(bytes);

            for (int i_1 = 0; i_1 < vectors.Length; i_1++)
            {
                ConcatVector.ReadFromStream(bArrIn);
            }
            ConcatVectorBenchmark.SerializationReport sr = new ConcatVectorBenchmark.SerializationReport();
            sr.time = Runtime.CurrentTimeMillis() - before;
            sr.size = bytes.Length;
            return(sr);
        }