[Investigations][Timeline] - Run Object.keys less frequently#219629
[Investigations][Timeline] - Run Object.keys less frequently#219629michaelolo24 merged 2 commits intoelastic:mainfrom
Conversation
| fields && | ||
| Object.keys(fields).find((field) => field !== fieldPath && fieldPath.startsWith(`${field}.`)); | ||
| fields: string[], | ||
| ): string | undefined => fields.find((field) => field !== fieldPath && fieldPath.startsWith(`${field}.`)); |
There was a problem hiding this comment.
This is the primary change. getNestedParentPath is called in a few looping constructs, and hitting Object.keys() on each iteration wasn't performant
💚 Build Succeeded
Metrics [docs]
|
|
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
janmonschke
left a comment
There was a problem hiding this comment.
Nice catch! Given hit.fields can potentially be huge, this could have quite some impact :)
|
Starting backport for target branches: 8.18, 8.19, 9.0 https://github.com/elastic/kibana/actions/runs/14757531244 |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…219629) (#219750) # Backport This will backport the following commits from `main` to `9.0`: - [[Investigations][Timeline] - Run Object.keys less frequently (#219629)](#219629) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michael Olorunnisola","email":"michael.olorunnisola@elastic.co"},"sourceCommit":{"committedDate":"2025-04-30T14:50:46Z","message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat Hunting:Investigations","backport:version","v9.1.0","v8.19.0","v9.0.1","v8.18.2"],"title":"[Investigations][Timeline] - Run Object.keys less frequently","number":219629,"url":"https://github.com/elastic/kibana/pull/219629","mergeCommit":{"message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219629","number":219629,"mergeCommit":{"message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
## Summary This PR makes a minor performance improvement by pulling out the `Object.keys` call on `hit.fields` out of any unnecessary loops. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
This PR didn't make it into the latest 9.0.1 BC. Updating the labels. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…219629) (#219749) # Backport This will backport the following commits from `main` to `8.19`: - [[Investigations][Timeline] - Run Object.keys less frequently (#219629)](#219629) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michael Olorunnisola","email":"michael.olorunnisola@elastic.co"},"sourceCommit":{"committedDate":"2025-04-30T14:50:46Z","message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat Hunting:Investigations","backport:version","v9.1.0","v8.19.0","v9.0.1","v8.18.2"],"title":"[Investigations][Timeline] - Run Object.keys less frequently","number":219629,"url":"https://github.com/elastic/kibana/pull/219629","mergeCommit":{"message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219629","number":219629,"mergeCommit":{"message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
…219629) (#219748) # Backport This will backport the following commits from `main` to `8.18`: - [[Investigations][Timeline] - Run Object.keys less frequently (#219629)](#219629) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michael Olorunnisola","email":"michael.olorunnisola@elastic.co"},"sourceCommit":{"committedDate":"2025-04-30T14:50:46Z","message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat Hunting:Investigations","backport:version","v9.1.0","v8.19.0","v9.0.1","v8.18.2"],"title":"[Investigations][Timeline] - Run Object.keys less frequently","number":219629,"url":"https://github.com/elastic/kibana/pull/219629","mergeCommit":{"message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/219629","number":219629,"mergeCommit":{"message":"[Investigations][Timeline] - Run Object.keys less frequently (#219629)\n\n## Summary\n\nThis PR makes a minor performance improvement by pulling out the\n`Object.keys` call on `hit.fields` out of any unnecessary loops.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"fd4ff0a2e872d7ba778c3de138e5919a29d61220"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
…#219629) ## Summary This PR makes a minor performance improvement by pulling out the `Object.keys` call on `hit.fields` out of any unnecessary loops. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
This PR makes a minor performance improvement by pulling out the
Object.keyscall onhit.fieldsout of any unnecessary loops.