@manhng

Welcome to my blog!

BenchmarkDotNet & Benchmarking

May 26, 2021 08:27

BenchmarkDotNet & Benchmarking (edit)

BenchmarkDotNet

  • We use benchmarks to find code performance
  • BenchmarkDotNet is a nuget package
  • We use console apps to host and run benchmarks

Introduction to BenchMarkDotNet – DevSuhas

Attach a debugger from IDE

Troubleshooting | BenchmarkDotNet

Measuring performance using BenchmarkDotNet - Part 1 - DEV Community

GitHub - NewDayTechnology/benchmarking-performance-part-1: A simple demonstration of BenchmarkDotNet

Measuring performance using BenchmarkDotNet - Part 2 - DEV Community

NewDayTechnology/benchmarking-performance-part-2: A simple demonstration of BenchmarkDotNet (github.com)

Measuring performance using BenchmarkDotNet - Part 3 Breaking Builds - DEV Community

Benchmarking and performance optimizations in C# using BenchmarkDotNet (stebet.net) (HAY HAY HAY)

SuhasParameshwara/BenchMarkDotNet_Demo: Comparing FirstOrDefault and SingleOrDefault using BenchMarkDotNet (github.com)

BenchmarkDotNet

dotnet/BenchmarkDotNet: Powerful .NET library for benchmarking (github.com)

BenchmarkDotNet Analyser

A tool for analysing BenchmarkDotNet results

NewDayTechnology/benchmarkdotnet.analyser: A tool for analysing BenchmarkDotNet results (github.com)

Awesome .NET Performance: Benchmarking

adamsitnik/awesome-dot-net-performance: A curated list of awesome .NET Performance books, courses, trainings, conference talks, blogs and most inspiring open source contributors. Inspired by awesome-... stuff. (github.com)

dotnet-reportgenerator-globaltool

NuGet Gallery | dotnet-reportgenerator-globaltool 4.8.9

Usage:
reportgenerator [options]
tools\reportgenerator.exe [options]
dotnet reportgenerator [options]

Dotnet Command Line Tools

mkdir c:\projects\scratch\tools
cd c:\
cd projects\scratch\tools

dotnet new nugetconfig

dotnet nuget add source https://nuget.pkg.github.com/NewDayTechnology/index.json --configfile ./nuget.config -n newdaytechnology -p nvmanhntq -u nvmanhntq

dotnet nuget list source

dotnet new tool-manifest

dotnet tool install bdna

dotnet tool install bdna --version 0.1.121-preview

C:\Program Files\dotnet\sdk\5.0.203\NuGet.targets

git init
git clone "https://github.com/NewDayTechnology/benchmarking-performance-part-2.git"
cd benchmarking-performance-part-2

#c:\projects\scratch\tools\benchmarking-performance-part-2

dotnet clean
dotnet restore
dotnet build -c Release

cd src\benchmarkdotnetdemo\bin\Release\net5.0

#c:\projects\scratch\tools\benchmarking-performance-part-2\src\benchmarkdotnetdemo\bin\Release\net5.0

dotnet Benchmarkdotnetdemo.dll -f *

dotnet bdna aggregate -new ".\src\benchmarkdotnetdemo\bin\Release\net5.0\BenchmarkDotNet.Artifacts\results" -aggs ".\bdna" -out ".\bdna" -runs 30

#c:\projects\scratch\tools\benchmarking-performance-part-2\src\benchmarkdotnetdemo\bin\Release\net5.0\BenchmarkDotNet.Artifacts\results

dotnet bdna analyse --aggregates ".\bdna" --tolerance 0 --maxerrors 0 --verbose

Asynchronous Programming Best Practies

April 23, 2021 13:44

Asynchronous Programming (edit)

Async/Await - Best Practices in Asynchronous Programming | Microsoft Docs (HAY HAY HAY)

Best practices in .Net asynchronous programming | InfoWorld (HAY HAY HAY)

Devops best practices: How to drive agility and operational excellence | InfoWorld

AppVeyor & Azure DevOps

AppVeyor: Tích hợp liên tục cho các nhà phát triển bận rộn

AppVeyor tự động hóa việc xây dựng, thử nghiệm và triển khai các ứng dụng .NET giúp nhóm của bạn tập trung vào việc cung cấp các ứng dụng tuyệt vời.

Login - AppVeyor

Các tính năng chính:

  • Không cần thiết lập hoặc bảo trì
  • Cấu hình xây dựng thân thiện với nhà phát triển bằng UI hoặc YAML
  • Xây dựng nhanh trên phần cứng chuyên dụng với ổ SSD
  • Xây dựng nhiều chi nhánh
  • Nhân viên và hỗ trợ cộng đồng
  • Trả giá khi bạn đi

Các phần mềm tương tự AppVeyor:

GitHub - ariya/karma-appveyor: Karma AppVeyor integration demo

BenchmarkDotNet

Powerful .NET library for benchmarking

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

Generate PDF Files

How to Generate PDF Files in Python with Xhtml2pdf, WeasyPrint or Unoconv - Gearheart

Creating PDF Reports with Pandas, Jinja and WeasyPrint - Practical Business Python (pbpython.com)

6 Things to Do Before You Outsource Web Development - Gearheart

Azure DevOps

Dịch vụ cho các nhóm chia sẻ mã, theo dõi công việc và gửi phần mềm cho bất kỳ ngôn ngữ nào. Đó là sự bổ sung hoàn hảo cho IDE của bạn.

Công cụ triển khai phần mềm hàng đầu: 25 công cụ hữu ích để hợp lý hóa việc phân phối cài đặt phần mềm - Danh Võ (danhvo.net)

CSS

  • Typography

  • Blueprint CSS

Avoid mixing asynchronous and synchronous code

You should never have a mix of synchronous and asynchronous code. It is a bad programming practice to block on async code by making calls to Task.Wait or Task.Result. I would recommend using async code end to end – it is the safest way to avoid errors from creeping in.

You can avoid deadlocks by using .ConfigureAwait(continueOnCapturedContext: false) whenever you make a call to await. If you don't use this, the async method would block at the point where await has been called. In this case you are just informing the awaiter not to capture the current context. I would say that it is a good practice to use .ConfigureAwait(false) unless you have a specific reason to not use it.

I would discuss more on asynchronous programming in my future blog posts here. For more information on best practices in asynchronous programming, you can refer to Stephen Cleary's great article at MSDN.

Code Coverage:

Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)

GitHub - FortuneN/FineCodeCoverage: Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)

FineCodeCoverage 1.1.144 - AppVeyor

Best Practices:

How to use SortedDictionary, SortedList, and SortedSet in C# | InfoWorld

How to benchmark C# code using BenchmarkDotNet | InfoWorld

How to work with Quartz.Net in C# | InfoWorld

How to use Moq to ease unit testing in C# | InfoWorld

How to perform lazy initialization in C# | InfoWorld

How to work with reflection in C# | InfoWorld

How to avoid temporal coupling in C# | InfoWorld

7 best practices for remote development teams | InfoWorld

You can explore a demo ASP.NET Core application that illustrates several ways to benchmark the code. You can get the application from the ASP.NET repo on GitHub. 

How to do more in C#: 

Categories

Recent posts