Exemple #1
0
        private static ulong[] CreateRandomVarints64(Random random, int valueCount, int encodedSize)
        {
            var result = new ulong[valueCount];

            for (int i = 0; i < valueCount; i++)
            {
                result[i] = ParseRawPrimitivesBenchmark.RandomUnsignedVarint(random, encodedSize, false);
            }
            return(result);
        }
Exemple #2
0
        private static uint[] CreateRandomVarints32(Random random, int valueCount, int encodedSize)
        {
            var result = new uint[valueCount];

            for (int i = 0; i < valueCount; i++)
            {
                result[i] = (uint)ParseRawPrimitivesBenchmark.RandomUnsignedVarint(random, encodedSize, true);
            }
            return(result);
        }
Exemple #3
0
        private static ByteString[] CreateByteStrings(int valueCount, int encodedSize)
        {
            var str = ParseRawPrimitivesBenchmark.CreateStringWithEncodedSize(encodedSize);

            var result = new ByteString[valueCount];

            for (int i = 0; i < valueCount; i++)
            {
                result[i] = ByteString.CopyFrom(Encoding.UTF8.GetBytes(str));
            }
            return(result);
        }
Exemple #4
0
        private static string[] CreateNonAsciiStrings(int valueCount, int encodedSize)
        {
            var str = ParseRawPrimitivesBenchmark.CreateNonAsciiStringWithEncodedSize(encodedSize);

            var result = new string[valueCount];

            for (int i = 0; i < valueCount; i++)
            {
                result[i] = str;
            }
            return(result);
        }