Topics
Memory Allocation Discipline Example
“I design for allocation discipline — especially in tight loops. For example, in our tick processor, we rent buffers from ArrayPool
Memory Allocation Discipline Example Async
Study notes and examples
O1 Constant Time
O(1) constant time means the work an operation does never grows with the size of the input — a million-entry dictionary lookup costs the same as a ten-entry one. Reaching it usually means choosing the right structure (hash tables,…
OLogN Logarithmic Time
O(log n) logarithmic time means each step throws away a constant fraction of the remaining work — doubling the data only adds one more step. This is the regime of binary search, balanced trees (SortedSet, SortedDictionary) and B-tree…
ON Linear Time
O(n) linear time means runtime grows in step with the input — doubling the data doubles the work. It's the floor for any algorithm that must look at every element (sums, filters, max/min, table scans), so the senior-engineer move is to…
ON2 Quadratic Time
O(n²) quadratic time grows with the square of the input — double the data and the work quadruples. It's the signature of nested loops over the same collection, Contains against a List
ONLogN Linearithmic Time
O(n log n) linearithmic time is the cost of touching every element while also dividing the problem in half — the proven lower bound for comparison-based sorting, and the complexity of OrderBy, List.Sort, mergesort, heapsort, and most…
Space Complexity
Space complexity measures how much memory an algorithm needs as input grows, and it's the other half of the performance picture next to time. Senior engineers actively trade between the two — caching turns O(n) lookups into O(1) at the…