
Single Instruction, Multiple Data (SIMD) in .NET
What is SIMD? SIMD lets you process 4, 8, or 16 values in a single CPU instruction — turning a loop over a million floats from seconds into milliseconds. .NET exposes SIMD through Vector<T> ...

What is SIMD? SIMD lets you process 4, 8, or 16 values in a single CPU instruction — turning a loop over a million floats from seconds into milliseconds. .NET exposes SIMD through Vector<T> ...

Before .NET 7 Before .NET 7, writing a single Sum<T>() method that worked across int, float, and double was either impossible or required ugly workarounds. Generic math — powered by static a...

NOTE: This series of articles use TypeChain to make strongly-typed calls to Ethereum. Please check its documentation and discussion board to learn how to set it up. It’s also assumed some knowledge...

In previous posts I explained how React Query can be used to query smart contracts, that is, to perform read calls. Now I’m going to explain how to mutate, that is, to execute transactions on the b...

Wallets that support multiple accounts and multiple blockchains, like MetaMask, make it very easy for a user to change active account and active blockchain. A web3 frontend should react immediately...

In my previous post I explained how useQuery can be used to retrieve the value from an immutable method. Now let’s go up a notch and see how to use on methods where the returned value may change ov...

React Query is often described as the missing data-fetching library for React, but in more technical terms, it makes fetching, caching, synchronizing and updating server state in your React applica...

Introduction A branch misprediction can cost 10–20 CPU cycles per iteration — and conditional logic inside tight loops is full of them. This article demonstrates practical techniques for removing ...

Introduction ArraySegment<T> predates Span<T> and avoids many of its restrictions — it works with generics, can be a class field, and supports IEnumerable<T>. But how does it act...

Implementing the sum of the items in an array is very simple. I think most developers would implement it this way: static int Sum(int[] array) { var sum = 0; for (var index = 0; index <...

Roslyn analyzers catch bugs before they reach production, but testing them is surprisingly tricky — you need to verify diagnostics fire on bad code and stay silent on good code, all without running...

Introduction Whether your enumerator is a value type or reference type can mean the difference between zero-allocation iteration and a heap allocation on every loop. The C# compiler generates diff...

Introduction Adding ToList() at the end of every LINQ query is one of the most common .NET performance anti-patterns — it forces immediate allocation and evaluation when neither may be needed. Thi...

Finding an item I already mentioned in the first article of this series that IEnumerable: doesn’t allow random access. doesn’t give access to any other collection information. This implies...

Count() Calling Count() on an IEnumerable looks harmless, but its performance depends entirely on the underlying collection type — and a single LINQ operator in the chain can silently destroy the ...