I would like to know which situation has more “overhead”:
1) Case 1: 5 million objects sharing 30 functions. every time a function is called, there is overhead because it is necessary to do f.call (instance, arg1, arg2, etc.)
function makeObject()
{
return { method1:func1,
method2:func2,
...
method30:func30 };
}
2) Case 2: 5 million objects with 30 functions each (= 150 million instances of individual functions). Every time a function is called, there is no “routing-overhead”, but, of course, with the victim having more instances
function makeObject()
{
return { method1:func1.bind(asd),
method2:func2.bind(asd),
...
method30:func30.bind(asd) };
}
5 million is just the number of my fingers printed at a time when my brain is still calculating a good number for an example.
, , , ?
( , eval )