-
Notifications
You must be signed in to change notification settings - Fork 26.1k
perf(router): don't create new serializer every time UrlTree.toString is called #15565
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
Conversation
packages/router/src/url_tree.ts
Outdated
@@ -103,6 +103,7 @@ function containsSegmentGroupHelper( | |||
* @stable | |||
*/ | |||
export class UrlTree { | |||
private serializer = new DefaultUrlSerializer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scope it to the file so that we don't have to create it for all new Tree ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
869fe8f
to
51385ed
Compare
@vicb fixed |
51385ed
to
b442853
Compare
packages/router/src/url_tree.ts
Outdated
@@ -294,6 +294,8 @@ export class DefaultUrlSerializer implements UrlSerializer { | |||
} | |||
} | |||
|
|||
const serializer = new DefaultUrlSerializer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this up and change the name to DEFAULT_SERIALIZER
pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, could you please only change the name then ?
b442853
to
d310581
Compare
d310581
to
1e8db1d
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
DefaultUrlSerializer
is stateless so there's no need to create a new instance every time.