2 ms·
Thanks for the benchmarks, I know the tradeoff for using this pattern. Im aware of that the function is defined in each object, and that it takes up memory. I
by bni 16y ago
Thanks for the benchmarks, I know the tradeoff for using this pattern.
Im aware of that the function is defined in each object, and that it takes up memory. I dont agree that the memory is leaked, it is reclaimed when the object is deleted.
As I never create millions of instances of objects, and this patterns dont seem to have a measurable impact on the rendering loop in my project, Ill just continue using it for now.
I would call the pattern you propose to be the "object factory" pattern. And I am curious how to do classical inheritance and encapsulated vars with it.