Patterns · Tips & Tricks

The Curiously Recurring Generic Pattern

This curious little pattern can be helpful for certain problems that involve generics. We’ll look at what it is, and at a couple of use cases for it. What is it? The Curiously Recurring Generic Pattern (CRGP) is a pattern where a class TFoo derives from a generic class, using the class TFoo itself as… Continue reading The Curiously Recurring Generic Pattern

Foundation · Optimization · Tips & Tricks · Uncategorized

Allocation-Free Collections

Say you have a method that creates a temporary list to gather some data. You calculate some statistics based on that data and then you destroy the list again. You call this method a lot, resulting in lots of memory allocations and deallocations and increased memory fragmentation. In addition, all this memory management takes time… Continue reading Allocation-Free Collections

Foundation · Uncategorized

Expand your Collections collection – Part 1: a generic set

Welcome to this first post in a series about custom (generic) collections in Delphi. These are part of our Grijjy Foundation library of classes and utilities that are used throughout our code base. Other Grijjy Repositories often depend on this library. Introducing TgoSet Have you ever doubted between using a TList<T> or TDictionary<T> to store… Continue reading Expand your Collections collection – Part 1: a generic set