# BenchmarkDotNET 科學化 .NET 應用效能調校 - 鮑承佑(老鮑伯) {%hackmd @HWDC/BJOE4qInR %} >#### 》[議程介紹](https://hwdc.ithome.com.tw/2024/session-page/3203) 投影片:<https://windperson.github.io/Hello_World_devconf_2024-slide> Sample code: <https://github.com/windperson/DemoFibonacciBDN> <https://github.com/windperson/DemoAspNetCoreMacroBenchmark> <https://github.com/windperson/DemoWpfAppBDN> <https://github.com/windperson/DemoOnnxRuntimeBDN> >#### 》[填寫議程滿意度問卷|回饋建言給辛苦的講者](https://forms.gle/bxCkts7KjYdy7vyv9) 也可以產出報表 Generate markdown, CSV, JSON, HTML, reports / png plots Microbenchmark / Macrobenchmark / Profiling Microbenchmark Macrobenchmark: 類似 E2E Test Profiling: Mobile & 原生 會遇到,更底層 CPU & Memory,錄製系統程式都會紀錄。 --- # A decent Benchmark workflow Warmup: 暖機之後的測試比較準確。 outliner:有時候系統過於繁忙,會有比較慢的就可以排除。 --- # Generated HelloBDN.csproj file: ``` <Configuration>Release</Configuration> 驗證都期望是驗 Release,不會想驗 Debug <IsPackable>false</IsPackable> 不打包 ``` --- # BDN mechanism 會把原始的專案複製一份出來,再由benchmark執行。 --- --- https://github.com/windperson/DemoFibonacciBDN/tree/main ``` //Baseline:會以這個方法為基礎,跟其他方法比速度。 [Benchmark(Baseline = true), BenchmarkCategory("simple", "canonical")] ``` ``` [MethodImpl(MethodImplOptions.NoInlining)] ``` # Web 可能出現的雷:如果Method,參數是string可能會有問題,改成class就可以了。 CSC : error CS8103: Combined length of user strings used by the program exceeds allowed limit. # Web (deal with ASP.NET Core Dependency Injection) gRPC 字串超過5萬會報錯,所以要加這個。 ``` channelOptions.MaxSendMessageSize = int.MaxValue; channelOptions.MaxReceiveMessageSize = int.MaxValue; ``` --- 推薦: Book: Pro .NET Benchmarking by Andrey Akinshin: https://aakinshin.net/prodotnetbenchmarking/ https://www.tenlong.com.tw/products/9781484249406
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up