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

Finding better implementations of PostTag and PostCategory #5604

Open
2 tasks done
D-Sketon opened this issue Jan 5, 2025 · 0 comments
Open
2 tasks done

Finding better implementations of PostTag and PostCategory #5604

D-Sketon opened this issue Jan 5, 2025 · 0 comments

Comments

@D-Sketon
Copy link
Member

D-Sketon commented Jan 5, 2025

Check List

  • I have already read Docs page.
  • I have already searched existing issues.

Feature Request

I was analysing the flame graph and noticed that PostTag has a lot of overheads.
{2D7AE0D6-7458-4960-9023-F3BFC92C79D2}
In fact, we can optimise these simple sets of binary relations with map and set.
I wrote a simple demo for this, and this is what I got by rewriting the PostTag:
8x many-posts
before

Cold processing
┌──────────────────────────────┬───────────────┐
│ (index)                      │ Cost time (s) │
├──────────────────────────────┼───────────────┤
│ Load Plugin/Scripts/Database │ '0.25s'       │
│ Process Source               │ '10.79s'      │
│ Render Posts                 │ '13.49s'      │
│ Render Files                 │ '13.64s'      │
│ Save Database                │ '1.21s'       │
│ Total time                   │ '39.38s'      │
└──────────────────────────────┴───────────────┘
Hot processing
┌──────────────────────────────┬───────────────┐
│ (index)                      │ Cost time (s) │
├──────────────────────────────┼───────────────┤
│ Load Plugin/Scripts/Database │ '2.14s'       │
│ Process Source               │ '7.03s'       │
│ Render Files                 │ '11.60s'      │
│ Save Database                │ '1.08s'       │
│ Total time                   │ '21.85s'      │
└──────────────────────────────┴───────────────┘
Another Cold processing
┌──────────────────────────────┬───────────────┐
│ (index)                      │ Cost time (s) │
├──────────────────────────────┼───────────────┤
│ Load Plugin/Scripts/Database │ '0.24s'       │
│ Process Source               │ '11.27s'      │
│ Render Posts                 │ '13.32s'      │
│ Render Files                 │ '13.74s'      │
│ Save Database                │ '1.00s'       │
│ Total time                   │ '39.56s'      │
└──────────────────────────────┴───────────────┘

after

Cold processing
┌──────────────────────────────┬───────────────┐
│ (index)                      │ Cost time (s) │
├──────────────────────────────┼───────────────┤
│ Load Plugin/Scripts/Database │ '0.25s'       │
│ Process Source               │ '6.50s'       │
│ Render Posts                 │ '9.32s'       │
│ Render Files                 │ '13.79s'      │
│ Save Database                │ '1.02s'       │
│ Total time                   │ '30.88s'      │
└──────────────────────────────┴───────────────┘
Hot processing
┌──────────────────────────────┬───────────────┐
│ (index)                      │ Cost time (s) │
├──────────────────────────────┼───────────────┤
│ Load Plugin/Scripts/Database │ '2.11s'       │
│ Process Source               │ '2.40s'       │
│ Render Files                 │ '8.04s'       │
│ Save Database                │ '1.01s'       │
│ Total time                   │ '13.56s'      │
└──────────────────────────────┴───────────────┘
Another Cold processing
┌──────────────────────────────┬───────────────┐
│ (index)                      │ Cost time (s) │
├──────────────────────────────┼───────────────┤
│ Load Plugin/Scripts/Database │ '0.24s'       │
│ Process Source               │ '6.44s'       │
│ Render Posts                 │ '9.20s'       │
│ Render Files                 │ '13.82s'      │
│ Save Database                │ '1.04s'       │
│ Total time                   │ '30.75s'      │

Others

No response

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

No branches or pull requests

1 participant