void (@NotNull Project project, @NotNull Component component, @NotNull MyRunner activityRunner) { ActionManagerImpl actionManager = (ActionManagerImpl)ActionManager.getInstance(); boolean isDumb = DumbService.isDumb(project); List<Pair<Integer, String>> results = new ArrayList<>(); DataContext rawContext = DataManager.getInstance().getDataContext(component); PsiManager.getInstance(project).dropPsiCaches(); PsiManager.getInstance(project).dropResolveCaches(); ActionToolbarImpl.resetAllToolbars(); LOG.info("Benchmarking actions update for component: " + component.getClass().getName()); long startContext = System.nanoTime(); DataContext wrappedContext = Utils.createAsyncDataContext(rawContext); LOG.info(TimeoutUtil.getDurationMillis(startContext) + " ms to create data-context"); long startPrecache = System.nanoTime(); ReadAction.run(() -> { for (DataKey<?> key : DataKey.allKeys()) { activityRunner.run("DataContext(\"" + key.getName() + "\")", null, () -> wrappedContext.getData(key)); } }); LOG.info(TimeoutUtil.getDurationMillis(startPrecache) + " ms to pre-cache data-context"); Set<String> nonUniqueClasses = new HashSet<>(); { Set<String> visited = new HashSet<>(); for (String id : actionManager.getActionIds()) { AnAction action = actionManager.getAction(id); if (action == null) continue; if (action.getClass() == DefaultActionGroup.class) continue; String className = action.getClass().getName(); if (!visited.add(className)) nonUniqueClasses.add(className); } } int count = 0; long startActions = System.nanoTime(); for (String id : actionManager.getActionIds()) { AnAction action = actionManager.getAction(id); if (action == null) { LOG.warn("no action for id: " + id); continue; } if (action.getClass() == DefaultActionGroup.class) continue; if (isDumb && !DumbService.isDumbAware(action)) continue; String className = action.getClass().getName(); String actionIdIfNeeded = nonUniqueClasses.contains(className) ? " (" + id + ")" : ""; String actionName = className + actionIdIfNeeded; ProgressManager.checkCanceled(); AnActionEvent event = AnActionEvent.createFromAnAction(action, null, ActionPlaces.MAIN_MENU, wrappedContext); runAndMeasure(results, actionName, () -> activityRunner.run(actionName, id, () -> ActionUtil.performDumbAwareUpdate(action, event, true))); count++; if (!(action instanceof ActionGroup)) continue; String childrenActionName = className + ".getChildren(" + (event.getPresentation().isEnabled() ? "+" : "-") + ")" + actionIdIfNeeded; runAndMeasure(results, childrenActionName, () -> activityRunner.run(actionName, id, () -> ((ActionGroup)action).getChildren(event))); } long elapsedActions = TimeoutUtil.getDurationMillis(startActions); LOG.info(elapsedActions + " ms total to update " + count + " registered actions"); results.sort(Comparator.comparingInt(o -> -o.first)); for (Pair<Integer, String> result : results) { if (result.first < MIN_REPORTED_UPDATE_MILLIS) break; LOG.info(result.first + " ms - " + result.second); } dumpActionUpdateThreads(nonUniqueClasses); }