repl.it
@anonymous/

HeavyAshamedForms

C#

No description

fork
loading
Files
  • main.cs
  • main.exe
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Diagnostics;
using System.Collections.Generic;

class MainClass {
  public static void Main (string[] args) {
    Stopwatch sw = new Stopwatch();

    List<object> SomeList = new List<object>();
    sw.Start();
    for (var i = 0; i < 100000; i++)
        SomeList.Insert(i, String.Empty);
    sw.Stop();
    Console.WriteLine(sw.Elapsed.TotalMilliseconds);
    sw.Reset();

    SomeList = new List<object>();
    sw.Start();
    for (var i = 0; i < 100000; i++)
        SomeList.Add(String.Empty);
    sw.Stop();
    Console.WriteLine(sw.Elapsed.TotalMilliseconds);
  }
}
?