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: overall improvements #4783

Merged
merged 2 commits into from Sep 23, 2021
Merged

perf: overall improvements #4783

merged 2 commits into from Sep 23, 2021

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Sep 22, 2021

What does it do?

  • Make some functions pure and move them to the top level
  • Avoid some Promise overhead

Avoid nested promise and use as less .then as possible (Every then the promise implementation will push the task into the next tick of the event loop)

  • Utilize Array method on non-performance-intensive tasks
  • Avoid using new Promise

The author of Bluebird once mentioned new Proimse is slow. And during my recent tests (benchmark suite), it is indeed slower than directly returned Promise, also uses more memory.

How to test

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

Pull request tasks

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

- Make some functions pure and move them to the top level
- Avoid some Promise overhead
- Utilize Array method on non-performance-intensive tasks
@coveralls
Copy link

coveralls commented Sep 22, 2021

Coverage Status

Coverage decreased (-0.05%) to 98.135% when pulling 5ea2ff6 on SukkaW:perf-refactor into a2ec6b2 on hexojs:master.

@SukkaW SukkaW changed the title perf: refactor to make overall changes perf: overall improvements Sep 22, 2021
@SukkaW SukkaW merged commit a342422 into hexojs:master Sep 23, 2021
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.

None yet

3 participants