public static void RunCsvListTest()
        {
            //ShiboSerializer.Serialize(os, graph, sets);

            //List<int> v = new List<int>();
            //v.Add(123);
            //v.Add(456);

            //IList<bool> v = new List<bool>();
            //v.Add(true);
            //v.Add(false);

            int n = 100;
            IList <Int32Class> v = new List <Int32Class>(n);

            for (int i = 0; i < n; i++)
            {
                v.Add(ShiboSerializer.Initialize <Int32Class>());
            }
            string csv = ShiboSerializer.ToCsv(v);

            //CsvHelper.CsvWriter c = new CsvHelper.CsvWriter();


            Console.WriteLine(csv);
        }
        public static void RunIntObjSeries()
        {
            //Random rd = new Random(1);
            var rd     = new Random(1);
            var floats = new List <IXYV>(100000);

            for (int i = 0; i < floats.Capacity; i++)
            {
                //floats.Add(new IXYV() { X = rd.Next() >> 15, Y = rd.Next() >> 15, V = rd.Next() >> 15 });
                floats.Add(new IXYV()
                {
                    X = rd.Next(), Y = rd.Next(), V = rd.Next()
                });
            }
            string s = ShiboSerializer.ToCsv(floats);
            //string s = JsonConvert.SerializeObject(floats);
            Stopwatch w = Stopwatch.StartNew();

            for (int i = 0; i < 10; i++)
            {
                //s = JsonConvert.SerializeObject(floats);
                s = ShiboSerializer.ToCsv(floats);
                //CsvHelper.CsvSerializer csv = new CsvHelper.CsvSerializer(null);
                //CsvHelper.CsvWriter w = new CsvHelper.CsvWriter(null);
            }


            w.Stop();
            Console.WriteLine(w.ElapsedMilliseconds + " " + s.Length);
            Console.ReadLine();
        }
Beispiel #3
0
        public void FastToCsv()
        {
            long sum = 0;

            for (int i = 0; i < N; i++)
            {
                var csv = ShiboSerializer.ToCsv(data);
                sum += csv.Length;
            }
        }
        public void TestInt8()
        {
            var data = new Int8Class[100];

            for (int i = 0; i < data.Length; i++)
            {
                data[i] = ShiboSerializer.Initialize <Int8Class>();
            }
            var expected = ServiceStack.Text.CsvSerializer.SerializeToCsv(data);
            var actual   = ShiboSerializer.ToCsv(data);

            Assert.AreEqual(expected, actual);
        }
        public static TestResult Test2(object graph)
        {
            //ShiboSerializer.Serialize(os, graph, sets);

            //List<int> v = new List<int>();
            //v.Add(123);
            //v.Add(456);

            var v = new List <bool>
            {
                true,
                false
            };

            //Int32Class v = Int32Class.Init();
            string csv = ShiboSerializer.ToCsv(v);

            Console.WriteLine(csv);
            return(null);
        }