<commit_before>﻿using Dapper;
using LambdicSql;
using LambdicSql.SqlServer;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;

namespace Performance
{
    class TableValues
    {
        public int IntVal { get; set; }
        public float FloatVal { get; set; }
        public double DoubleVal { get; set; }
        public decimal DecimalVal { get; set; }
        public string StringVal { get; set; }
    }
    class DB
    {
        public TableValues TableValues { get; set; }
    }

    [TestClass]
    public class SelectTime
    {
        [TestMethod]
        public void CheckLambdicSql()
        {
            var executor = Sql.Query<DB>().SelectFrom(db => db.TableValues).ToExecutor(new SqlServerAdapter(TestEnvironment.ConnectionString));

            var times = new List<long>();
            for (int i = 0; i < 10; i++)
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                var datas = executor.Read().ToList();
                watch.Stop();
                times.Add(watch.ElapsedMilliseconds);
            }
            MessageBox.Show(string.Join(Environment.NewLine, times.Select(e=>e.ToString())) + Environment.NewLine + times.Average().ToString());
        }

        [TestMethod]
        public void CheckDapper()
        {
            using (var connection = new SqlConnection(TestEnvironment.ConnectionString))
            {
                var times = new List<long>();
                for (int i = 0; i < 10; i++)
                {
                    Stopwatch watch = new Stopwatch();
                    watch.Start();
                    var datas = connection.Query<TableValues>("select IntVal, FloatVal, DoubleVal, DecimalVal, StringVal from TableValues;").ToList();
                    watch.Stop();
                    times.Add(watch.ElapsedMilliseconds);
                }
                MessageBox.Show(string.Join(Environment.NewLine, times.Select(e => e.ToString())) + Environment.NewLine + times.Average().ToString());
            }
        }
    }
}<commit_msg>change measuring method.<commit_after>﻿using Dapper;
using LambdicSql;
using LambdicSql.SqlServer;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;

namespace Performance
{
    class TableValues
    {
        public int IntVal { get; set; }
        public float FloatVal { get; set; }
        public double DoubleVal { get; set; }
        public decimal DecimalVal { get; set; }
        public string StringVal { get; set; }
    }
    class DB
    {
        public TableValues TableValues { get; set; }
    }

    [TestClass]
    public class SelectTime
    {
        [TestMethod]
        public void CheckLambdicSql()
        {
            var adaptor = new SqlServerAdapter(TestEnvironment.ConnectionString);

            var times = new List<long>();
            for (int i = 0; i < 10; i++)
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                var datas = Sql.Query<DB>().SelectFrom(db => db.TableValues).ToExecutor(adaptor).Read().ToList();
                watch.Stop();
                times.Add(watch.ElapsedMilliseconds);
            }
            MessageBox.Show(string.Join(Environment.NewLine, times.Select(e=>e.ToString())) + Environment.NewLine + times.Average().ToString());
        }

        [TestMethod]
        public void CheckDapper()
        {
            using (var connection = new SqlConnection(TestEnvironment.ConnectionString))
            {
                var times = new List<long>();
                for (int i = 0; i < 10; i++)
                {
                    Stopwatch watch = new Stopwatch();
                    watch.Start();
                    var datas = connection.Query<TableValues>("select IntVal, FloatVal, DoubleVal, DecimalVal, StringVal from TableValues;").ToList();
                    watch.Stop();
                    times.Add(watch.ElapsedMilliseconds);
                }
                MessageBox.Show(string.Join(Environment.NewLine, times.Select(e => e.ToString())) + Environment.NewLine + times.Average().ToString());
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.10935738444193913, 'fraction_numerical': 0.002705749718151071, 'mean_word_length': 1.937748344370861, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536387', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1137, 'n_words': 274}