-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Selector performance #72380
Selector performance #72380
Conversation
export function children(tree: IndexedProcessTree, process: ResolverEvent): ResolverEvent[] { | ||
const id = uniquePidForProcess(process); | ||
const currentProcessSiblings = tree.idToChildren.get(id); | ||
export function children(tree: IndexedProcessTree, parentID: string | undefined): ResolverEvent[] { |
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.
This can return children for a node that isn't in the tree itself. For example, the root node of the tree may have a parent that isn't in the tree. Also, the root node may have no parent (undefined.)
@@ -133,6 +129,8 @@ export function root(tree: IndexedProcessTree) { | |||
export function* levelOrder(tree: IndexedProcessTree) { | |||
const rootNode = root(tree); | |||
if (rootNode !== null) { | |||
yield* baseLevelOrder(rootNode, children.bind(null, tree)); | |||
yield* baseLevelOrder(rootNode, (parentNode: ResolverEvent): ResolverEvent[] => | |||
children(tree, uniquePidForProcess(parentNode)) |
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.
children
now takes an id
, since the parent may not be in-memory.
|
||
for (const process of processesInReverseLevelOrder) { | ||
const children = model.children(indexedProcessTree, process); | ||
const children = model.children(indexedProcessTree, uniquePidForProcess(process)); |
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.
children
now takes an id
, since the parent may not be in-memory.
@@ -226,7 +229,7 @@ function processEdgeLineSegments( | |||
metadata: edgeLineMetadata, | |||
}; | |||
|
|||
const siblings = model.children(indexedProcessTree, parent); | |||
const siblings = model.children(indexedProcessTree, uniquePidForProcess(parent)); |
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.
children
now takes an id
, since the parent may not be in-memory.
@@ -420,7 +423,7 @@ function* levelOrderWithWidths( | |||
parentWidth, | |||
}; | |||
|
|||
const siblings = model.children(tree, parent); | |||
const siblings = model.children(tree, uniquePidForProcess(parent)); |
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.
children
now takes an id
, since the parent may not be in-memory.
@@ -90,7 +92,7 @@ export const terminatedProcesses = createSelector(resolverTree, function (tree?: | |||
/** | |||
* Process events that will be graphed. | |||
*/ | |||
export const graphableProcesses = createSelector(resolverTree, function (tree?) { | |||
export const graphableProcesses = createSelector(resolverTreeResponse, function (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.
renaming stuff
@@ -62,7 +62,7 @@ export function hasError(state: DataState): boolean { | |||
* The last ResolverTree we received, if any. It may be stale (it might not be for the same databaseDocumentID that | |||
* we're currently interested in. | |||
*/ | |||
const resolverTree = (state: DataState): ResolverTree | undefined => { | |||
const resolverTreeResponse = (state: DataState): ResolverTree | undefined => { |
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.
renaming stuff
@@ -173,16 +180,16 @@ export function relatedEventsReady(data: DataState): Map<string, boolean> { | |||
* `true` if there were more children than we got in the last request. | |||
*/ | |||
export function hasMoreChildren(state: DataState): boolean { | |||
const tree = resolverTree(state); | |||
return tree ? resolverTreeModel.hasMoreChildren(tree) : false; | |||
const resolverTree = resolverTreeResponse(state); |
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.
renaming stuff
} | ||
|
||
/** | ||
* `true` if there were more ancestors than we got in the last request. | ||
*/ | ||
export function hasMoreAncestors(state: DataState): boolean { | ||
const tree = resolverTree(state); | ||
return tree ? resolverTreeModel.hasMoreAncestors(tree) : false; | ||
const resolverTree = resolverTreeResponse(state); |
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.
renaming stuff
@@ -248,7 +255,7 @@ export const relatedEventInfoByEntityId: ( | |||
}); | |||
}; | |||
|
|||
const matchingEventsForCategory = defaultMemoize(unmemoizedMatchingEventsForCategory); |
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.
This would be garbage collected as there is no dominator
* Calls the `secondSelector` with the result of the `selector`. Use this when re-exporting a | ||
* concern-specific selector. `selector` should return the concern-specific state. | ||
*/ | ||
function composeSelectors<OuterState, InnerState, ReturnValue>( |
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.
moved to bottom of file
bbce3b1
to
546079d
Compare
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
@@ -164,7 +164,8 @@ export const scale: (state: CameraState) => (time: number) => Vector2 = createSe | |||
scalingConstants.maximum | |||
); | |||
|
|||
return (time) => { | |||
// memoizing this so the vector returned will be the same object reference if called with the same `time`. | |||
return defaultMemoize((time) => { |
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.
any reason to not do this for all of the time based selectors?
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.
I didn't do it for isAnimating
because it returns a primitive and is trivial enough that there should be no perf gain to memoizing.
I didn't do it for visibleNodesAndEdgeLines
because it just calls two functions which are each already memoized.
I think I did it everywhere else.
* Memoize various selectors * Improve performance of the selectors that calculate the `aria-flowto` attribute. * more tests.
* Memoize various selectors * Improve performance of the selectors that calculate the `aria-flowto` attribute. * more tests.
* master: (60 commits) [SIEM][Detection Engine][Lists] Adds list permissions (elastic#72335) [SIEM][Detection Engine][Lists] Adds conflict versioning and io-ts improvements to lists (elastic#72337) [Resolver] no longer pass related event stats to process node component (elastic#72435) Revert "skip flaky suite (elastic#72146)" [Security Solution] Cleanup endpoint telemetry (elastic#71950) Unskip dashboard embeddable rendering tests (elastic#71824) [ENDPOINT] Added unerolling status for host. (elastic#72303) [Alerting][Connectors] Increase the size of the logos (elastic#72419) [SECURITY] [Timeline] Raw events not displayed (elastic#72387) [ML] Fixes display of regression stop stats if one is NaN (elastic#72412) [Ingest Pipelines] Processor Editor Move Tooltip (elastic#72239) Fix match phrase and not match phrase comparators (elastic#71850) [Plugin Generator] Generate tsconfig and useDefaultBehaviors (elastic#72040) [Security Solution][Timeline] Fix timeline styling and createFrom beh… (elastic#72152) [Resolver] Selector performance (elastic#72380) [Ingest Manager] Set `_meta` in the index.mappings (elastic#72026) [Ingest Manager] Do not bumb config revision during config creation (elastic#72270) [ML] Adding missing index pattern name to new job wizards (elastic#72400) [ML] improve annotation flyout performance (elastic#72299) [APM] Testing error rate API and restructuring folders (elastic#72257) ...
* master: (26 commits) [SIEM][Detection Engine][Lists] Adds list permissions (elastic#72335) [SIEM][Detection Engine][Lists] Adds conflict versioning and io-ts improvements to lists (elastic#72337) [Resolver] no longer pass related event stats to process node component (elastic#72435) Revert "skip flaky suite (elastic#72146)" [Security Solution] Cleanup endpoint telemetry (elastic#71950) Unskip dashboard embeddable rendering tests (elastic#71824) [ENDPOINT] Added unerolling status for host. (elastic#72303) [Alerting][Connectors] Increase the size of the logos (elastic#72419) [SECURITY] [Timeline] Raw events not displayed (elastic#72387) [ML] Fixes display of regression stop stats if one is NaN (elastic#72412) [Ingest Pipelines] Processor Editor Move Tooltip (elastic#72239) Fix match phrase and not match phrase comparators (elastic#71850) [Plugin Generator] Generate tsconfig and useDefaultBehaviors (elastic#72040) [Security Solution][Timeline] Fix timeline styling and createFrom beh… (elastic#72152) [Resolver] Selector performance (elastic#72380) [Ingest Manager] Set `_meta` in the index.mappings (elastic#72026) [Ingest Manager] Do not bumb config revision during config creation (elastic#72270) [ML] Adding missing index pattern name to new job wizards (elastic#72400) [ML] improve annotation flyout performance (elastic#72299) [APM] Testing error rate API and restructuring folders (elastic#72257) ...
…feature-privileges * alerting/consumer-based-rbac: (45 commits) fixed alerts test [SIEM][Detection Engine][Lists] Adds list permissions (elastic#72335) [SIEM][Detection Engine][Lists] Adds conflict versioning and io-ts improvements to lists (elastic#72337) [Resolver] no longer pass related event stats to process node component (elastic#72435) Revert "skip flaky suite (elastic#72146)" [Security Solution] Cleanup endpoint telemetry (elastic#71950) Unskip dashboard embeddable rendering tests (elastic#71824) [ENDPOINT] Added unerolling status for host. (elastic#72303) [Alerting][Connectors] Increase the size of the logos (elastic#72419) [SECURITY] [Timeline] Raw events not displayed (elastic#72387) [ML] Fixes display of regression stop stats if one is NaN (elastic#72412) [Ingest Pipelines] Processor Editor Move Tooltip (elastic#72239) Fix match phrase and not match phrase comparators (elastic#71850) [Plugin Generator] Generate tsconfig and useDefaultBehaviors (elastic#72040) [Security Solution][Timeline] Fix timeline styling and createFrom beh… (elastic#72152) allow user to disable alert even if they dont have privileges to the underlying action [Resolver] Selector performance (elastic#72380) [Ingest Manager] Set `_meta` in the index.mappings (elastic#72026) [Ingest Manager] Do not bumb config revision during config creation (elastic#72270) [ML] Adding missing index pattern name to new job wizards (elastic#72400) ...
Summary
aria-flowto
attribute.No behaviour changes intended.
screenshot at 546079d
Checklist
For maintainers