public static void MainNew(string[] args) { string path = @"..\..\..\Databases\"; string src_path = @"D:\home\FactographDatabases\dataset\dataset1M.ttl"; StringIntCoding sic = new StringIntCoding(path); Console.WriteLine("Start"); DateTime tt0 = DateTime.Now; DateTime tt00 = tt0; int portion_size = 1000000; int n_portions = 10; sic.Clear(); HashSet <string> hs = new HashSet <string>(); }
// Тест преобразования Guid'ов public static void Main11(string[] args) { string path = @"..\..\..\Databases\"; StringIntCoding sic = new StringIntCoding(path); Console.WriteLine("Start"); DateTime tt0 = DateTime.Now; DateTime tt00 = tt0; int portion_size = 5000000; int n_portions = 20; sic.Clear(); HashSet <string> hs = new HashSet <string>(); //SortedSet<string> hs = new SortedSet<string>(); for (int j = 0; j < n_portions; j++) { tt0 = DateTime.Now; hs.Clear(); for (int i = 0; i < portion_size; i++) { string id = Guid.NewGuid().ToString(); hs.Add(id); } Console.WriteLine("Set ok. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; string[] arr = new string[hs.Count]; hs.CopyTo(arr); // Array.Sort<string>(arr); // Console.WriteLine("Sorting ok. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; var dic = sic.InsertPortion(arr); Console.WriteLine("InsertPortion ok. portion=" + j + " HashSet.Size=" + hs.Count + " duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; } Console.WriteLine("Total: {0}", (DateTime.Now - tt00).Ticks / 10000L); }
public static void Main(string[] args) { string path = @"..\..\..\Databases\"; var strings = Enumerable.Range(0, 1000) .Select(i => Guid.NewGuid().ToString()) .Select((guid, i) => new { guid, i }) .ToDictionary(arg => arg.guid, arg => arg.i); StringIntRAMDIctionary ramdIctionary = new StringIntRAMDIctionary(path + "ram dictionary", strings); foreach (var g_i in strings) { if (g_i.Value != ramdIctionary.GetCode(g_i.Key)) { throw new KeyNotFoundException(); } } return; StringIntCoding sic = new StringIntCoding(path); Console.WriteLine("Start"); DateTime tt0 = DateTime.Now; DateTime tt00 = tt0; int portion_size = 100; int n_portions = 10; sic.Clear(); sic.InsertPortion((Enumerable.Range(-10, 0).Select(i => i.ToString())).ToArray()); sic.InsertPortion((Enumerable.Range(0, 10).Select(i => i.ToString())).ToArray()); sic.MakeIndexed(); Console.WriteLine(sic.GetName(4)); Console.WriteLine(sic.GetCode("0")); }