>
And if you need mandatory initialization, ... do it like in pascalABC and anonymous classes? There it looks like var p := new class(Name, Age);
not better
if you have 100 fields, you would end up initializing them in random order and by random data widths.
That hardly would be faster than a single run of FillChar(ptr, total size, 0)
and you can not avoid initializations, because you would have managed, ARC-driven types (long strings, interfaces, dyn-arrays, annonymous functions (interfaces too), etc). and every field of that type MUST be zeroed out.
But if you want, you have it - "advanced records" - they do run Initialize(...) and it traverses RTTI to precisel zero only ARC-fields and leave garbage in others. Is it much better? Then use advanced records not classes.
Now, there still is the 3rd options, the Tubo-Pascal style objects, rather than classes. They are told to be faster. But simpler. I consider TObject.AfterConstruction a great hook, provifing great flexibility, but it makes construction code flow much more convoluted, thus slow. Still, go into KOL forum ,and they stick with objects not classes, if i got that right. Cause they want a smallest possible footprint and they do not need rich funcitonality.
Those KOL maniacs... I remember i made a 2KB DLL with them - only to find that Windows can never laod such a small thing :-)