-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve FilterPathBasedFilter performance (#79826)
FilterPathBasedFilter is used for filter XContent. Old FilterPath is implemented with a linked list. When it has many patterns. The filter performance is lower. I implement a new FilterPath. It use a Tree to filter XContent. The FilterPath Tree has two kind of children. - One is a hashmap for term pattern. It can find the match field in O(1). - Another is a hashmap for wildcard pattern.It will check all node of hashmap. The benchmark I added in #80069 shows runtime halved in the non-wildcard cases. The wildcardcases have pretty similar runtime. There is an increase in runtime when newly building the filter each time. This is acceptable because the cases where we have to be as fast as possible we're already reusing the filter. ``` Benchmark (fieldCount) (data) Mode Cnt Before ns/op After ns/op NewParserConfig 10_field cluster_stats avgt 3 120303.585 120724.363 NewParserConfig 10_field index_stats avgt 3 22163.350 25700.478 NewParserConfig 10_field node_stats avgt 3 25838.040 25455.610 NewParserConfig half_field cluster_stats avgt 3 1052058.673 551504.323 NewParserConfig half_field index_stats avgt 3 99443.623 64639.860 NewParserConfig half_field node_stats avgt 3 119383.384 78739.087 NewParserConfig all_field cluster_stats avgt 3 1850317.142 949238.665 NewParserConfig all_field index_stats avgt 3 135923.737 102391.586 NewParserConfig all_field node_stats avgt 3 177303.659 134091.199 NewParserConfig wildcard_field cluster_stats avgt 3 242419.000 158402.969 NewParserConfig wildcard_field index_stats avgt 3 19677.926 16604.226 NewParserConfig wildcard_field node_stats avgt 3 21932.954 20135.669 NewParserConfig 10_wildcard_field cluster_stats avgt 3 217022.657 186846.661 NewParserConfig 10_wildcard_field index_stats avgt 3 33292.234 27895.644 NewParserConfig 10_wildcard_field node_stats avgt 3 41748.139 31325.693 ParserConfigReused 10_field cluster_stats avgt 3 120882.036 94980.708 ParserConfigReused 10_field index_stats avgt 3 16474.120 12325.762 ParserConfigReused 10_field node_stats avgt 3 20947.328 14945.972 ParserConfigReused half_field cluster_stats avgt 3 393069.494 182547.734 ParserConfigReused half_field index_stats avgt 3 28891.619 17536.035 ParserConfigReused half_field node_stats avgt 3 32433.385 22170.274 ParserConfigReused all_field cluster_stats avgt 3 551217.667 210148.246 ParserConfigReused all_field index_stats avgt 3 45367.850 20630.002 ParserConfigReused all_field node_stats avgt 3 55899.647 24953.435 ParserConfigReused wildcard_field cluster_stats avgt 3 159949.383 173188.846 ParserConfigReused wildcard_field index_stats avgt 3 15713.951 17187.918 ParserConfigReused wildcard_field node_stats avgt 3 19171.149 19932.483 ParserConfigReused 10_wildcard_field cluster_stats avgt 3 172137.559 173138.035 ParserConfigReused 10_wildcard_field index_stats avgt 3 24635.608 21296.013 ParserConfigReused 10_wildcard_field node_stats avgt 3 28866.104 26567.965 ```
- Loading branch information
Showing
4 changed files
with
327 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.