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

[5.x] Cache entry uri #9844

Merged
merged 18 commits into from
Apr 29, 2024
Merged

[5.x] Cache entry uri #9844

merged 18 commits into from
Apr 29, 2024

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Apr 8, 2024

This attempts to lower the overhead of getting an Entry's URI, which is currently heavy because it's built on the fly every time.

It will now Blink the URI so it's faster in the request, as well as saving it to the Stache so it doesn't have to be re-evaluated at all on subsequent requests.

I'm using a few pages of the Docs for benchmarks:

## Home (light page)
- 4.x: 450ms
- master: 310ms (improvement: 31%)
- Entry URI PR: 300ms (improvement over master: 3%, improvement over 4.x: 33%)

## /reference (medium page)
- 4.x: 990ms
- master: 640ms (improvement: 35%)
- Entry URI PR: 440ms (improvement over master: 31%, improvement over 4.x: 56%)

## /reference/modifiers (heavy page)
- 4.x: 1510ms
- master: 910ms (improvement: 40%)
- Entry URI PR: 560ms (improvement over master: 38%, improvement over 4.x: 63%)

Replaces #9587

@jasonvarga jasonvarga changed the title [5.x] Cache entry uri to a property [5.x] Cache entry uri Apr 24, 2024
When the uri is evaluated, the parser caches the tag list. Since the tag isn't available at that point, when we try to use it in the view, it's missing.

Moving the tag registration earlier makes it available when the parser does the uri. It's more reflective of a real life solution anyway. Tags would be registered early.
First of all, a slug of just a slash is a bit weird. Surprising it worked to begin with.
Second, now that when generating the uri, it might end up reading the file again. Since the collectino created a line above requires slugs by default, it took the filename which was just the id, and used it as a slug. When we did ->get('/') it would 404 because it thinks the uri is actually /1.

Easy fix is to just use an explicit not-a-slash slug.
@jasonvarga jasonvarga marked this pull request as ready for review April 29, 2024 19:50
@jasonvarga jasonvarga merged commit 6b63786 into master Apr 29, 2024
31 checks passed
@jasonvarga jasonvarga deleted the entry-uri branch April 29, 2024 19:56
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.

1 participant