A really interesting feature quietly slipped into C# 7.3 - interesting to me, at least - but which I’ve seen almost no noise about. As I’ve said many times before: I have niche interests - I spend a lot of time in library code, or acting in a consulting capacity on performance tuning application code - so in both capacities, I tend to look at performance tweaks that aren’t usually needed , but…
or alternatively: How did updating to .NET 6 break asp-net redis cache for some users? Whereby I present the history of Redis-64, along with options and motivations for Redis-64 users on Windows to consider updating their redis via Memurai. Running Redis on Windows, 2022 edition; replacing Redis-64 A funny thing happened recently; after updating to .NET 6, some StackExchange.Redis users started…
I’m going to talk about reflection-heavy libraries; I will describe the scenario I’m talking about - as it is commonly used today, the status quo, giving a brief overview of the pros and cons of this, and then present the case that times have changed , and with new language and runtime features: it may be time to challenge our way of thinking about this kind of library. I’m a code-first kind of…
Disclaimer: I'll be honest: many of the concepts in this post are a bit more advanced - some viewer caution is advised! It touches on concurrent linked async enumerators that share a termination condition by combining multiple CancellationToken . Something that I've been looking at recently - in the context of gRPC (and protobuf-net.Grpc in particular) - is the complex story of duplex data pipes.…
Here I'm going to discuss the mechanisms and concepts relating to async iterators in C# - with the hope of both demystifying them a bit, and also showing how we can use some of the more advanced (but slightly hidden) features. I'm going to give some illustrations of what happens under the hood, but note: these are illustrations , not the literal generated expansion - this is deliberately to help…
tl;dr: seriously, stop using BinaryFormatter The other evening, in the context of protobuf-net.Grpc , someone asked me whether it was possible to use BinaryFormatter as the marshaller. This isn't an unreasonable question, especially as protobuf-net.Grpc is designed to allow you to swap out the marshaller (gRPC is usually used with protobuf, but it isn't restricted to that as long as both ends…
tl,dr; opinion: ongoing .NET Framework support for F/OSS libraries may quickly start evaporating, and this should be a consideration in migration planning. First, a clarification of terms, because they matter: .NET Framework - the original .NET, the one that ships on Windows and only on Windows; the current (and probably final) version of .NET Framework is 4.8 .NET Core - the evolution of .NET,…
Preamble - not a part 2 A little while ago I blogged here and I set it up to be a "continues..." style post. I haven't had the energy to continue it in that context, and this fact was putting me off concluding the post. I then realised: the thing that matters isn't some overarching narrative structure, but that I get my ideas down. So: I'm aborting any attempt at making this post a continuation,…
Subtitled: "a cautionary tale of SemaphoreSlim ", an adventure in two parts: In part 1 I want to discuss a very fun series of problems we had in some asynchronous code - where "fun" here means "I took Stack Overflow offline, again". Partly because it is a fun story, but mostly because I think there's some really useful learning points in there for general adventures in asynchronicity In part 2 I…
Normally I write about programming topics (usually .NET); today I'm going to veer very far from that track - and talk about society, mental health, individual and corporate responsibility, and personal relationships. I genuinely hope you hear me out, but if that isn't your thing ... well, then you probably need to read it more than most. I could try a clever reverse psychology trick to oblige you…
One Tool To Rule Them All A recent twitter thread reminded me of a trope that I see frequently as a library author (and just as a general observer) - let’s call it “monotoolism”. Examples of this might be examples like: “wait, you’re still using ‘LINQ to SQL’? I thought you were using ‘Dapper’?” “Google’s protobuf impementation provides opinionated JSON parsing, but my JSON doesn’t fit that layout…
An update on what's happening with protobuf-net Headline: .proto processing now works directly from dotnet build and MSBuild, without any need for DSL processing steps; and - new shiny things in the future. I haven't spoken about protobuf-net for quite a while, but: it is very much alive and active. However, I really should do a catch-up, and I'm really excited about where we are. Level 100…
Pipelines - a guided tour of the new IO API in .NET, part 3.1 ( part 1 , part 2 , part 3 ) After part 3, I got some great feedback - mostly requests to clarify things that I touched on, but could do with further explanation. Rather than make part 3 even longer , I want to address those here! Yay, more words! Isn't ArrayPoolOwner<T> doing the same thing as MemoryPool<T> ? Why don't you just use…
Pipelines - a guided tour of the new IO API in .NET, part 3 Update: please also see part 3.1 for further clarifications on this post Sorry, it has been longer than anticipated since part 2 (also: part 1 ). A large part of the reason for that is that I've been trying to think how best to explain some of the inner guts of StackExchange.Redis in a way that makes it easy to understand, and is useful…
Pipelines - a guided tour of the new IO API in .NET, part 2 In part 1 , we discussed some of the problems that exist in the familiar Stream API, and we had an introduction to the Pipe , PipeWriter and PipeReader APIs, looking at how to write to a single Pipe and then consume the data from that Pipe ; we also discussed how FlushAsync() and ReadAsync() work together to keep both sides of the…
Pipelines - a guided tour of the new IO API in .NET, part 1 (part 2 here) About two years ago I blogged about an upcoming experimental IO API in the .NET world - at the time provisionally called "Channels"; at the end of May 2018, this finally shipped - under the name System.IO.Pipelines . I am hugely interested in the API, and over the last few weeks I'm been consumed with converting…
Having a serious conversation about open source A certain topic has been surfacing a lot lately on places like twitter; one that I've quietly tried to ignore, but which has been gnawing away at me slowly. It is seemingly the most taboo, dirty and avoided topics. Open source and money See, I said it was taboo and dirty Talking openly about money is always hard, but when you combine money and open…
...where I go silly with optimization Yes, I’m still talking about sorting... ish. I love going deep on problems - it isn’t enough to just have a solution - I like knowing that I have the best solution that I am capable of . This isn’t always possible in a business setting - deadlines etc - but this is my own time. In part 1 , we introduced the scenario - and discussed how to build a composite…
( part 1 here ) ( part 3 here ) So last time I talked about a range of ways of performing a sort, ranging from the simple thru to hijacking .NET source code. Very quickly, some folks pointed out that I should have looked at “radix sort”, and they’re absoltely right - I should have. In fact, in the GPU version of this same code, we do exactly that via the CUB library . The great thing is, radix…
( part 2 here ) ( part 3 here ) I love interesting questions, especially when they directly relate to things I need to do. A great question came up on Stack Overflow today about how to efficiently sort large data . I gave an answer, but there’s so much more we can say on the topic, so I thought I’d turn it into a blog entry, exploring pragmatic ways to improve sort performance when dealing with…
Why Doesn't Dapper Use Prepared Statements? I had a very interesting email in my inbox this week from a Dapper user; I'm not going to duplicate the email here, but it can be boiled down to: My external security consultant is telling me that Dapper is insecure because it doesn't use prepared statements, and is therefore susceptible to SQL injection. What are your thoughts on this? with a…
protobuf-net gets proto3 For quite a little while, protobuf-net hasn't seen any major changes. Sure, I've been pottering along with ongoing maintenance and things like .NET Core support, but it hasn't had any step changes in behavior. Until recently. 2.3.0 Released I'm pleased to say that 2.3.0 has finally dropped . The most significant part of this is "proto3", which ties into the 3.0.0 version…
protobuf-net was born into a different world On Jul 17, 2008 I pushed the first commits of protobuf-net . It is easy to forget, but back then , most machines had access to a lot less memory than they do today, with x86 still being a common choice, meaning that 2GB user space (or maybe a little more if you fancied fighting with /3GB+LAA) was a hard upper limit. In reality, your usable memory was…
StackExchange.Redis and Redis Modules This is largely a brain-dump of my plans for Redis 4.0 Modules and the StackExchange.Redis client library. Redis 4.0 is in RC 3 , which is great for folks interested in Redis. As the primary maintainer of StackExchange.Redis , new releases also bring me some extra work in terms of checking whether there are new features that I need to incorporate into the…
Spans and ref part 2 : spans In part 1 , we looked at ref locals and ref return , and hinted at a connection to “spans”; this time we’re going to take a deeper look at what this connection might be, and how we can use make use of it. Disclaimer I’m mostly on the outside of this - looking in at the public artefacts, playing with the API etc - maybe the odd PR or issue report. It is entirely…