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

jerry: optimize the keyword scans via perfect hash #515

Open
yorkie opened this issue Apr 27, 2019 · 1 comment
Open

jerry: optimize the keyword scans via perfect hash #515

yorkie opened this issue Apr 27, 2019 · 1 comment

Comments

@yorkie
Copy link
Member

yorkie commented Apr 27, 2019

v8 improves the special keyword match via the perfect hash algorithm, and document it at https://v8.dev/blog/scanner#keywords, for implementation of v8, see keywords-gen.h.

The current JerryScript impl just checks the length between 2 to 10, and an optimized memcmp to match one of keywords or not, then I think this method on v8 should work on JerryScript, too.

/cc @algebrait @LaszloLango @legendecas

@LaszloLango
Copy link
Contributor

I just took a quick look on this. If I understand this correctly then it will be only a parse time improvement. IMHO, the source code parsing is fast enough, the gain won't be measurable. Have you investigated what would be the cost (in memory usage and binary size) of using a perfect hash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants