写了一个简单的测试程序, 测试Chrome/Edge/Firefox 的WSAM引擎的执行效率, 结果是 Edge 优于 Chrome 远优于 Firefox.
测试代码:
@page "/perf" <p>Performace testing </p> @code{ protected override void OnInitialized(){ testNumber(); testString(); } void testNumber(){ var d1=DateTime.Now; for (int i = 0; i < 100000; i++) { int j=i ; } var d2=DateTime.Now; TimeSpan ts=d2-d1; Console.WriteLine("testNumber() TotalSeconds:"+ts.TotalSeconds.ToString()); } void testString(){ var d1=DateTime.Now; for (int i = 0; i < 100000; i++) { string a=i+"aaaaaaaaaaaaaaaaaaaaaaaaaa" ; } var d2=DateTime.Now; TimeSpan ts=d2-d1; Console.WriteLine("testString() TotalSeconds:"+ts.TotalSeconds.ToString()); } }