Beispiel #1
0
        public EntryPoint()
        {
            flats = new Flat[100];
            var random = new Random(123123);

            for (int i = 0; i < flats.Length; ++i)
            {
                flats[i]        = new Flat();
                flats[i].Number = random.Next();
                if (random.Next(5) > 0)
                {
                    flats[i].Kitchen = new Room
                    {
                        NumberOfDoors   = random.Next(),
                        NumberOfWindows = random.Next(),
                        Area            = random.Next()
                    };
                }
                if (random.Next(5) > 0)
                {
                    flats[i].Room = new Room
                    {
                        NumberOfDoors   = random.Next(),
                        NumberOfWindows = random.Next(),
                        Area            = random.Next()
                    };
                }
            }
            staticRunner   = new SerializerRunner(flats, new StaticSerializer());
            dynamicRunner  = new SerializerRunner(flats, new DynamicSerializer());
            grobufRunner   = new GroBufRunner <Flat>(flats);
            protobufRunner = new ProtoBufRunner <Flat>(flats);
        }
Beispiel #2
0
        public void Setup()
        {
            switch (mode)
            {
            case "small":
            {
                var objects = Generate <Orders>(10, 30, 5, 2);
                grobufRunner              = new GroBufRunner <Orders>(objects);
                protobufRunner            = new ProtoBufRunner <Orders>(objects);
                grobufRunnerStringLeafs   = new GroBufRunner <Invoic>(new Invoic[0]);
                protobufRunnerStringLeafs = new ProtoBufRunner <Invoic>(new Invoic[0]);
                break;
            }

            case "big":
            {
                var objects = Generate <Orders>(10, 60, 10, 5);
                grobufRunner              = new GroBufRunner <Orders>(objects);
                protobufRunner            = new ProtoBufRunner <Orders>(objects);
                grobufRunnerStringLeafs   = new GroBufRunner <Invoic>(new Invoic[0]);
                protobufRunnerStringLeafs = new ProtoBufRunner <Invoic>(new Invoic[0]);
                break;
            }

            case "small_strings":
            {
                var objects = Generate <Invoic>(10, 30, 5, 2);
                grobufRunner   = new GroBufRunner <Orders>(new Orders[0]);
                protobufRunner = new ProtoBufRunner <Orders>(new Orders[0]);

                grobufRunnerStringLeafs   = new GroBufRunner <Invoic>(objects);
                protobufRunnerStringLeafs = new ProtoBufRunner <Invoic>(objects);
                break;
            }

            case "big_strings":
            {
                var objects = Generate <Invoic>(10, 60, 10, 5);
                grobufRunner              = new GroBufRunner <Orders>(new Orders[0]);
                protobufRunner            = new ProtoBufRunner <Orders>(new Orders[0]);
                grobufRunnerStringLeafs   = new GroBufRunner <Invoic>(objects);
                protobufRunnerStringLeafs = new ProtoBufRunner <Invoic>(objects);
                break;
            }

            case "small_mixed":
            {
                var objects = Generate <Orders>(20, 30, 5, 2);
                grobufRunner   = new GroBufRunner <Orders>(objects);
                protobufRunner = new ProtoBufRunner <Orders>(objects);
                var objectsStringLeafs = Generate <Invoic>(80, 30, 5, 2);
                grobufRunnerStringLeafs   = new GroBufRunner <Invoic>(objectsStringLeafs);
                protobufRunnerStringLeafs = new ProtoBufRunner <Invoic>(objectsStringLeafs);
                break;
            }

            case "big_mixed":
            {
                var objects = Generate <Orders>(2, 60, 10, 5);
                grobufRunner   = new GroBufRunner <Orders>(objects);
                protobufRunner = new ProtoBufRunner <Orders>(objects);
                var objectsStringLeafs = Generate <Invoic>(8, 60, 10, 5);
                grobufRunnerStringLeafs   = new GroBufRunner <Invoic>(objectsStringLeafs);
                protobufRunnerStringLeafs = new ProtoBufRunner <Invoic>(objectsStringLeafs);
                break;
            }
            }
        }