본문 바로가기
Programming/.NET

[.NET] BenchmarkDotNet로 .NET 6 vs .NET 4.7.2 성능 비교

by 째스터 2023. 1. 15.
728x90

BenchmarkDotNet 를 이용해서 .NET 6와 .NET 4.7.2 성능을 비교하는 방법

1. csproj 파일에 아래 코드를 추가한다.

    <TargetFrameworks>net6.0;net472</TargetFrameworks>
    <PlatformTarget>AnyCPU</PlatformTarget>

2.  Benchmark할 method나 class에 아래 Attribute를 추가한다.

나는 .NET 4.7.2 vs .NET 6를 비교할 예정이라 2개를 추가했다.

3. Release 모드 바꾸고 Run without Debugging 을 클릭한다.

아무 시나리오 없이 그냥 튜토리얼에 주어지는 소스코드를 사용했다.

https://github.com/HanJaeJoon/DotNetBenchmark-net472-net6

 

GitHub - HanJaeJoon/DotNetBenchmark-net472-net6

Contribute to HanJaeJoon/DotNetBenchmark-net472-net6 development by creating an account on GitHub.

github.com

https://github.com/dotnet/BenchmarkDotNet

 

GitHub - dotnet/BenchmarkDotNet: Powerful .NET library for benchmarking

Powerful .NET library for benchmarking. Contribute to dotnet/BenchmarkDotNet development by creating an account on GitHub.

github.com

 

728x90

댓글