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

perf(injector): shorthand optimization #4462

Merged
merged 3 commits into from
Aug 8, 2020

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Aug 3, 2020

What does it do?

It is common that many user won't have many plugins installed which is utilizing Injector. Also, rare SDK requires adding snippets right after <head> or <body>. AFAIK only facebook SDK requires adding <script> right after <body>.

The PR adds shorthand optimization to avoid unnecessary String#replace.

How to test

git clone -b perf-injector-shorthand https://github.com/sukkaw/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@SukkaW SukkaW requested review from stevenjoezhang, curbengh and a team August 3, 2020 08:36
@coveralls
Copy link

coveralls commented Aug 3, 2020

Coverage Status

Coverage increased (+0.003%) to 98.242% when pulling 5b8c44a on SukkaW:perf-injector-shorthand into 0fb1866 on hexojs:master.

Copy link
Contributor

@curbengh curbengh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with hexojs/hexo-math#130 in a dummy blog.

@SukkaW SukkaW merged commit ec1e39f into hexojs:master Aug 8, 2020
@curbengh curbengh mentioned this pull request Aug 10, 2020
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.

3 participants