Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why HookCodeFactory generated code? #114

Closed
elpupi opened this issue Nov 14, 2019 · 3 comments
Closed

Why HookCodeFactory generated code? #114

elpupi opened this issue Nov 14, 2019 · 3 comments

Comments

@elpupi
Copy link

elpupi commented Nov 14, 2019

Please, could you explain why HookCodeFactory is generating code?

@alexander-akait
Copy link
Member

Why should he not do this? Can you tell me why you are using this module, since it is for internal use in webpack?

@sokra
Copy link
Member

sokra commented Dec 16, 2019

It is generating code to create a function which is calling all attached plugins. The function depends on the number and type of the plugins. By creating a custom function the v8 is able to inline calls to plugins into the monomorphic callsides. This would not be possible when looping over an array of plugins (which creates polymorphic callsides).

@alexander-akait
Copy link
Member

Answer above

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

No branches or pull requests

3 participants