[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: New object system in 7 LoC
- From: Stefan Reich <stefan.reich.maker.of.eye@...>
- Date: Mon, 21 Nov 2011 14:39:12 +0000
On Mon, Nov 21, 2011 at 2:15 PM, Leo Razoumov <email@example.com> wrote:
An elegant idea, indeed! And 'self' reference is avoided.
There is one problem, though.
Every time you create a new object instance brand new closures for all
your instance methods are created as well. In case you have many small
objects it can cost you memory and also CPU.
Yeah, that is true. The system is mainly meant for large objects of which relatively few are created at runtime.
In my case, it's for the whole Mobile Lua engine core. Which has a lot of code and few instances (usually just one, but we want to have the option of creating more if needed).