X Tutup
Skip to content

Instantiate exception only when required#198

Merged
lbalmaceda merged 1 commit intoauth0:masterfrom
inventage:improve-performance
Aug 29, 2017
Merged

Instantiate exception only when required#198
lbalmaceda merged 1 commit intoauth0:masterfrom
inventage:improve-performance

Conversation

@rumdidumdum
Copy link
Copy Markdown
Contributor

The convertFromJSON() method in the JWTParser class instantiates an exception (which is accompanied by an invocation of the somewhat expensive String.format() method) for every JSON string to be converted. This occurs even if the given JSON string is valid and the exception will never be thrown. As the convertFromJSON() method is invoked twice for every token verification this PR proposes to only instantiate an exception if the JSON string is invalid, hence requiring the exception to actually be thrown.

@lbalmaceda lbalmaceda self-requested a review August 29, 2017 13:29
Copy link
Copy Markdown
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

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

Thank you!

@lbalmaceda lbalmaceda added this to the v3-Next milestone Aug 29, 2017
@lbalmaceda lbalmaceda merged commit ba902e9 into auth0:master Aug 29, 2017
@rumdidumdum rumdidumdum deleted the improve-performance branch August 30, 2017 07:08
@lbalmaceda lbalmaceda modified the milestones: v3-Next, 3.3.0 Nov 6, 2017
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.

2 participants

X Tutup