我这里测试,c++比.net 5的慢一点点,
但是c++把那个new提出来之后,比.net 5的要快一点点。
但是c++再把那个new放回原位后,跟.net 5的差不多。
这里面有计时的问题,我用GetTickCount计时,这是受到tick精度影响的。
所以要首先把测量方法搞准。这个要不准的话,有个几百毫秒的差异都算是正常的。
13.x秒的三次是包括了new的,12.x秒的四次是提前new的(new的时间没算在内)。
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 13.094
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 13.250
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 13.266
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 12.593
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 12.531
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 12.672
c:\temp\test_LIEF\ConsoleApplication1\x64\Release>ConsoleApplication1.exe
time: 12.484
.net 5和.net 6都把new提到intperf()的外面。前三次是.net 5的,后几次是.net 6的
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
12.84
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
12.88
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
12.80
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): warning NETSDK1182: 不支持在 Visual Studio 2019 中以 .NET 6.0 为目标。 [C:\temp\CsharpConsoleApp1\CsharpConsoleApp1\CsharpConsoleApp1.csproj]
12.98
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): warning NETSDK1182: 不支持在 Visual Studio 2019 中以 .NET 6.0 为目标。 [C:\temp\CsharpConsoleApp1\CsharpConsoleApp1\CsharpConsoleApp1.csproj]
12.91
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): warning NETSDK1182: 不支持在 Visual Studio 2019 中以 .NET 6.0 为目标。 [C:\temp\CsharpConsoleApp1\CsharpConsoleApp1\CsharpConsoleApp1.csproj]
12.75
C:\temp\CsharpConsoleApp1\CsharpConsoleApp1>dotnet run CsharpConsoleApp1.dll
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): warning NETSDK1182: 不支持在 Visual Studio 2019 中以 .NET 6.0 为目标。 [C:\temp\CsharpConsoleApp1\CsharpConsoleApp1\CsharpConsoleApp1.csproj]
12.72
--
修改:z16166 FROM 114.245.195.*
FROM 114.245.195.*