String Performance: Appending a Character using the StringBuilder
DotNetTips Blog
by dotNetDave
1d ago
The use of a single character with a StringBuilder from an ObjectPool can improve performance. Benchmark results show similar overall performance, but without an ObjectPool, using a character becomes more significant. It is recommended to use a character in such cases. EditorConfig setup can check for this issue using dotnet_diagnostic.CA1834.severity = warning ..read more
Visit website
Code It Any Way You Want: Checking Strings for Null
DotNetTips Blog
by dotNetDave
1d ago
The article discusses best practices for checking strings for null in coding. It outlines three common methods: using == null, is null, or string.IsNullOrEmpty ..read more
Visit website
General Performance Tips
DotNetTips Blog
by dotNetDave
1d ago
These articles delves into indispensable tips that should consistently be integrated into your coding practices. Though these tips may seem small, their cumulative impact becomes pronounced, particularly when handling high message volumes. Embracing these fundamental practices can yield substantial benefits for overall performance ..read more
Visit website
Reference Type & Structure Performance: Hashing Classes, Records, and Structures
DotNetTips Blog
by dotNetDave
1d ago
A SHA256 hash can be generated for a class, record, or structure using a specific code. Performance analysis shows that hashing a class is 1.032 times faster than a structure and 1.048 times more efficient than a record. The memory allocations for record, reference, and value types are also provided in bytes ..read more
Visit website
General Performance Tip: Cloning Various Types
DotNetTips Blog
by dotNetDave
6d ago
The post discusses the process of cloning different types of objects, with Microsoft recommending the use of JSON serialization for this purpose. The author explores the performance differences in cloning reference types, value types, and record types. Benchmark results using JsonSerializer reveal that cloning reference types is 1.015 times faster than cloning record types and 1.24 times more performant than cloning value types. The findings are shared for reference ..read more
Visit website
String Performance: Slicing a String
DotNetTips Blog
by dotNetDave
1w ago
The content presents an alternative approach to obtaining a substring using slicing with ReadOnlySpan and AsSpan() methods, delivering performance improvement of 2.4 times based on benchmark tests. Configuration for detecting this issue in EditorConfig is also provided using dotnet_diagnostic.CA1831.severity = error ..read more
Visit website
Rockin’ the Code World Season 4: Special Guest Milan Jovanović 
DotNetTips Blog
by dotNetDave
1w ago
I hope you will join me on Saturday, May 5th, 2024, at 10:00 PST on C# Corner TV for show #101! For the second time, my very special guest will be Milan Jovanović, Software Architect, .NET Content Creator ..read more
Visit website
ChatGPT’s Tarot Shuffle: Random Musings on Love, Family, and Financial Fortunes
DotNetTips Blog
by dotNetDave
1w ago
The funny article explores the practice of Tarot card readings, emphasizing their subjective interpretation and potential for personal reflection rather than supernatural insight. Through a randomized selection by ChatGPT, the author examines the relevance of Tarot readings to their own life, highlighting skepticism tempered with curiosity about the process's validity ..read more
Visit website
Code It Any Way You Want: Optimizing Span Operations – Clear vs. Fill
DotNetTips Blog
by dotNetDave
1w ago
The article compares the performance of Clear() and Fill() methods in Microsoft code analysis for Span operations. Surprisingly, Fill() outperforms Clear() by 1.06 times, despite expectations. Both methods execute without memory allocations. The article recommends configuring EditorConfig to check for this issue with dotnet_diagnostic.CA1855 set to suggestion ..read more
Visit website
DotNetDave Story: The Critical Importance of Addressing Performance Before Product Release
DotNetTips Blog
by dotNetDave
1w ago
dotNetDave Story: The Critical Importance of Addressing Performance Before Product Release,' I recount a personal anecdote from my time at a San Diego-based company, highlighting the consequences of overlooking performance issues prior to release. Despite raising concerns, the failure to address these issues resulted in customer loss and ongoing struggles to improve performance post-launch ..read more
Visit website

Follow DotNetTips Blog on FeedSpot

Continue with Google
Continue with Apple
OR