Today as well as last Thursday I uploaded two more V8Js releases to PECL, both
fixing issues around
v8::FunctionTemplate usage that bit me at work.
v8::FunctionTemplate objects are used to construct constructor
functions (and thus object templates) in V8. The problem with them? They are
not object to garbage collection. So if we export a object with a method
attached to it from PHP to JS, V8Js at first exports the object (and caches
v8::FunctionTemplate used to construct it; re-using it on subsequent
export of the same class). If JS code wants to call the method first the
named property is got, which exports a function object (via a
object is invoked. The problem: this
v8::FunctionTemplate was not cached,
hence re-created on each and every call of the method, of course leading to
problems if functions are called thousands of times.