Skip to content

Refactor CrossOriginFilter with small perf improvements#4672

Merged
gregw merged 2 commits intojetty:jetty-10.0.xfrom
dennyac:refactor-cross-origin-filter
Mar 16, 2020
Merged

Refactor CrossOriginFilter with small perf improvements#4672
gregw merged 2 commits intojetty:jetty-10.0.xfrom
dennyac:refactor-cross-origin-filter

Conversation

@dennyac
Copy link
Copy Markdown
Contributor

@dennyac dennyac commented Mar 14, 2020

Hi maintainers,

I've made a small change to split the list of origins into a set of origins (for exact match) and a list of patterns (for pattern match). This way for exact match we can check if the set contains the origin (instead of iterating through the list) and only iterate through the origins for pattern matching.

This change also creates patterns during the init phase, instead of creating a new Pattern object during each request

Functionality remains unchanged. Not sure if any tests need to be added, but do let me know if any specific tests are required.

Force pushed for adding signoff

@dennyac dennyac force-pushed the refactor-cross-origin-filter branch from 99874e7 to 904cd38 Compare March 14, 2020 16:38
Signed-off-by: Denny Abraham Cheriyan <dennyac@gmail.com>
@dennyac dennyac force-pushed the refactor-cross-origin-filter branch from 904cd38 to 3c4ab14 Compare March 14, 2020 16:41
@dennyac
Copy link
Copy Markdown
Contributor Author

dennyac commented Mar 15, 2020

Will look into the build issues and resolve it.

Signed-off-by: Denny Abraham Cheriyan <dennyac@gmail.com>
@dennyac
Copy link
Copy Markdown
Contributor Author

dennyac commented Mar 16, 2020

Fixed checkstyle violation

Copy link
Copy Markdown
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Nice!
Ultimately we probably should look to use our IncludeExcludeSet mechanism here, but this is a good improvement within the same semantic.

I think this is also worthwhile in jetty-9.4, so I will merge and then cherry-pick back.

@gregw gregw merged commit fb00422 into jetty:jetty-10.0.x Mar 16, 2020
gregw pushed a commit that referenced this pull request Mar 16, 2020
* Refactor CrossOriginFilter

Signed-off-by: Denny Abraham Cheriyan <dennyac@gmail.com>

* Fix checkstyle violation

Signed-off-by: Denny Abraham Cheriyan <dennyac@gmail.com>
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