Skip to content

Conversation

@D-Sketon
Copy link
Member

@D-Sketon D-Sketon commented Jan 5, 2025

What does it do?

#5604
To improve performance, I introduced indexes for binary relations to improve lookup speeds.

The overhead from find and findOne is now largely invisible on the flamegraph:
c056b048cd926cfbfa30878dcbaa2bac

Screenshots

8x many-posts
before
{C7212CF8-98E1-4DA2-A226-600C384C8BA6}
after
{593ECE99-E775-414E-BE3D-C8C319E1931E}

1x many-posts
before
{8DAD029C-5887-4141-8188-AB4C6707A77D}
after
{4DB12F93-ACD0-4D8F-8157-3DCA4FF23E8F}

This is a huge boost for blogs with a super large number of posts, but hopefully this won't have any side effects on the generation of the site.

Pull request tasks

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

@github-actions
Copy link

github-actions bot commented Jan 5, 2025

How to test

git clone -b perf/binary-relation-index https://github.com/D-Sketon/hexo.git
cd hexo
npm install
npm test

@D-Sketon D-Sketon requested a review from a team January 10, 2025 03:48
@coveralls
Copy link

coveralls commented Jan 10, 2025

Pull Request Test Coverage Report for Build 13067175174

Details

  • 154 of 159 (96.86%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 99.448%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/models/binary_relation_index.ts 95 100 95.0%
Totals Coverage Status
Change from base Build 12902994421: -0.04%
Covered Lines: 9728
Relevant Lines: 9782

💛 - Coveralls

SukkaW
SukkaW previously approved these changes Jan 10, 2025
@SukkaW SukkaW requested a review from a team January 10, 2025 10:05
renbaoshuo
renbaoshuo previously approved these changes Jan 10, 2025
@D-Sketon D-Sketon dismissed stale reviews from renbaoshuo and SukkaW via e2583ac January 12, 2025 03:40
@D-Sketon
Copy link
Member Author

No hook will be triggered during the warehouse import process, so we must manually trigger the saveHook after loading the db.json.

@uiolee uiolee merged commit 4362bf4 into hexojs:master Feb 6, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants