mikernet
Why lambda is faster than other approaches?
i.e. in real world code you might have more than one implementation of the comparer interface/delegate fighting for dominance in which case the devirt PGO optimizations won't be as effective as they are in your benchmarks where one implementation of the comparer clearly dominates in frequency of calls and thus is the clear choice for prioritizing for devirt for PGO
10 replies
Why lambda is faster than other approaches?
Making your comparer a struct instead of a class isn't helpful, and is actually hurting things. Your comparer benchmark has an unnecessary boxing operation and allocation on every iteration right now. Change it to a sealed class and use the typical singleton comparer pattern instead.
Besides that, delegate calls have always been faster than interface calls. The heuristic I use is that a virtual interface call has about twice the overhead of a virtual delegate call or virtual class call, so that is something to consider. Net8+ kind of complicates things in terms of benchmarks reflecting actual real-world performance and figuring out exactly "why" X is benching faster than Y with all the dynamic PGO devirtualization stuff going on as well. There's a lot of JIT magic happening these days that optimizes stuff.
10 replies
wpf elements with a vertical alignment of top aren't exactly at the top and have a weird gap.
Uno Hot Design is actually pretty damn slick. Uno made designers great again. It embeds the designer into the running application in debug mode and you toggle it with the debug toolbar. Your changes are to the actual live application. The XAML designer revolution is coming, albeit for WinUI / Uno 😄
113 replies
created a basic C# .NET WinForms app to clean system files like temp, prefetch, and cache.
Your question is too broad to be answered in any useful way.
1) Learn C#
2) Learn WinForms
3) Add checkboxes to a form in WinForms
4) Write the code to delete selected system files.
3 replies
❔ WPF draw over other arbitrary controls
There's some good info here that you can use: http://drwpf.com/blog/2008/07/20/itemscontrol-g-is-for-generator/
53 replies
❔ WPF draw over other arbitrary controls
I think this is what you want: https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.itemscontrol.itemcontainergenerator?view=windowsdesktop-7.0#system-windows-controls-itemscontrol-itemcontainergenerator
53 replies