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

[Lexer] Improve codec of HTML escape characters #364

Open
LuoZijun opened this issue Apr 10, 2019 · 2 comments
Open

[Lexer] Improve codec of HTML escape characters #364

LuoZijun opened this issue Apr 10, 2019 · 2 comments
Labels

Comments

@LuoZijun
Copy link
Contributor

@LuoZijun LuoZijun commented Apr 10, 2019

Code Line: https://github.com/swc-project/swc/blob/master/ecmascript/parser/src/lexer/jsx.rs#L60

@kdy1

Full HTML escape characters support: LuoZijun/es@b67338f

Ref: HTML Character entity references

benchmark:

test lexer::htmlentity::bench_escape_html_with_bytes   ... bench:     226,428 ns/iter (+/- 67,908) = 503 MB/s
test lexer::htmlentity::bench_escape_html_with_chars   ... bench:     258,850 ns/iter (+/- 42,165) = 440 MB/s
test lexer::htmlentity::bench_escape_html_with_str     ... bench:     231,982 ns/iter (+/- 87,126) = 491 MB/s
test lexer::htmlentity::bench_unescape_html_with_bytes ... bench:     284,332 ns/iter (+/- 39,198) = 409 MB/s
test lexer::htmlentity::bench_unescape_html_with_chars ... bench:     328,042 ns/iter (+/- 22,807) = 355 MB/s
test lexer::htmlentity::bench_unescape_html_with_str   ... bench:     287,491 ns/iter (+/- 42,134) = 405 MB/s
@LuoZijun
Copy link
Contributor Author

@LuoZijun LuoZijun commented Apr 10, 2019

@kdy1

Compared to htmlescape this library, my implementation is a complete implementation, and also has better performance, if you are interested, it will also improve the performance of SWC Lexer and parse more complex escape sequences.

@marisasrida01
Copy link

@marisasrida01 marisasrida01 commented Dec 30, 2019

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.