mvcExpress-framework icon indicating copy to clipboard operation
mvcExpress-framework copied to clipboard

Prototype linked lists instead of inheritance for extendability

Open MindScriptAct opened this issue 10 years ago • 0 comments

Inperitance VS composition VS linked list test results for 3 Object chain:

[MethodTest name='Create inheritance test:' time=157.4 min=151 max=161 deviation=0.064 memory=829] [MethodTest name='Create composition test:' time=544.1 min=481 max=664 deviation=0.336 memory=848] [MethodTest name='Create linkedList test:' time=291.7 min=281 max=305 deviation=0.082 memory=833]

[MethodTest name='Run inheritance test:' time=234.4 min=223 max=245 deviation=0.094 memory=784] [MethodTest name='Run composition test:' time=302.9 min=291 max=313 deviation=0.073 memory=785] [MethodTest name='Run linkedList test:' time=264.8 min=249 max=288 deviation=0.147 memory=784]

Running with composition costs 30% more then inheritance. Running with linked lists costs 10% more then inheritance.

Prototyping inheritance for extensions sounds like good idea.

MindScriptAct avatar May 09 '14 17:05 MindScriptAct