有人知道 .NET 4 是否更高效?
从下面的简单片段来看,它似乎更慢。使用 .NET 4.0 大约需要 630 毫秒,使用 .NET 3.5 SP1 大约需要 530 毫秒。
你得到什么结果?有什么建议么?我正在考虑将我的应用程序转换为 .NET 4.0,但这些结果让我望而却步。
        Stopwatch sw = new Stopwatch();
        sw.Start();
        for (int i = 0; i <= 1000000; i++)
        {
            string s = "asdfx54545454545454545454545454545454545454545454545454545454545454545454545454adsf4asdf";
            int j = s.IndexOf("asdf");
            s.IndexOf("asdf", j);
            s = s + "zxcv";
            s = s + "gtjiortege";
        }
        sw.Stop();
        Console.WriteLine(sw.ElapsedMilliseconds);
        Console.ReadLine();