Skip to content

Conversation

@stesie
Copy link
Member

@stesie stesie commented Sep 1, 2015

It was already noted @todo in the code, but never implemented.

Currently we create a new v8::FunctionTemplate on every export of a PHP array to V8. Unfortunately those are not object to garbage collection, hence it is a particular bad to repeatedly create those templates, if the PHP code exports millions of arrays to V8 :-)

Now the global v8js_ctx has a persistent refernce to the FunctionTemplate, which now is initialized on first Array-export to V8. Succeeding exports re-use the template; and finally the reference is cleared on isolate deconstruction.

stesie added a commit that referenced this pull request Sep 1, 2015
Cache pseudo-Array FunctionTemplate as well
@stesie stesie merged commit fa352e2 into phpv8:master Sep 1, 2015
@stesie stesie deleted the cache-array-tmpl branch September 1, 2015 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant