Skip to content

Optimise RouteValues #5293

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

Merged
merged 1 commit into from
Feb 2, 2021
Merged

Optimise RouteValues #5293

merged 1 commit into from
Feb 2, 2021

Conversation

stevejgordon
Copy link
Contributor

Adds a reusable ResolvedRouteValues instance for all requests where there are no RouteValues.

This reduces allocs and improves perf slightly.

|           Method |      Mean |    Error |    StdDev |    Median |  Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------------- |----------:|---------:|----------:|----------:|-------:|------:|------:|----------:|
|              Old | 222.59 ns | 9.174 ns | 26.616 ns | 212.48 ns | 0.0496 |     - |     - |     208 B |
| OldParameterless |  88.45 ns | 1.761 ns |  2.582 ns |  88.09 ns | 0.0172 |     - |     - |      72 B |
|              New | 202.92 ns | 5.285 ns |  9.117 ns | 201.08 ns | 0.0496 |     - |     - |     208 B |
| NewParameterless |  11.94 ns | 0.273 ns |  0.570 ns |  11.79 ns |      - |     - |     - |         - |

Gets rid of the Resolved ResolvedRouteValues on RouteValues in favour of a lighter bool which still supports the IndexRequest requirement.

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@stevejgordon stevejgordon merged commit 46caff6 into 7.x Feb 2, 2021
@stevejgordon stevejgordon deleted the perf/route-values branch February 2, 2021 06:48
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2021

The backport to master failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-master master
# Navigate to the new working tree
cd .worktrees/backport-master
# Create a new branch
git switch --create backport-5293-to-master
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick ---mainline 1 46caff6d1b5a7cdecb39a962df0fcfdfbd132a41
# Push it to GitHub
git push --set-upstream origin backport-5293-to-master
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-master

Then, create a pull request where the base branch is master and the compare/head branch is backport-5293-to-master.

stevejgordon added a commit that referenced this pull request Feb 2, 2021
(cherry picked from commit 46caff6)
stevejgordon added a commit that referenced this pull request Feb 2, 2021
(cherry picked from commit 46caff6)
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.

2 participants