flutter-intellij
flutter-intellij copied to clipboard
[perf] migrate slow operations to non-blocking calls
We're doing a lot of long-running processing on the UI thread which is
- hurting performance, and
- spamming the logs (distracting users as in https://github.com/flutter/flutter-intellij/issues/7151, https://github.com/flutter/flutter-intellij/issues/7641 and https://github.com/flutter/flutter-intellij/issues/8083)
We've had issues safely making the change to use the prescribed ReadAction.nonBlocking APIs (see for example: https://github.com/flutter/flutter-intellij/issues/7792) so we'll want to proceed thoughtfully.
This issue will stand as a tracker for migrations.
Some resources:
🚧🚧🚧
Blocking calls to migrate:
- [x] #8093
- [x] https://github.com/flutter/flutter-intellij/pull/8094
- [x] https://github.com/flutter/flutter-intellij/pull/8095
- [x]
io.flutter.bazel.WorkspaceCache#refresh- [x] https://github.com/flutter/flutter-intellij/issues/8083
- [ ]
io.flutter.run.SdkRunConfig#getState
SdkRunConfig.addConsoleFilters:
java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc.
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.intellij.util.SlowOperations.assertSlowOperationsAreAllowed(SlowOperations.java:114)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:153)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:98)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:267)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.findFileSet(WorkspaceFileIndexImpl.kt:220)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.isInContent(WorkspaceFileIndexImpl.kt:86)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.isInContent(ProjectFileIndexImpl.java:211)
at com.jetbrains.lang.dart.util.PubspecYamlUtil.findPubspecYamlFile(PubspecYamlUtil.java:58)
at com.jetbrains.lang.dart.util.DartUrlResolverImpl.<init>(DartUrlResolverImpl.java:47)
at com.jetbrains.lang.dart.util.DartUrlResolver.getInstance(DartUrlResolver.java:36)
at com.jetbrains.lang.dart.ide.runner.DartConsoleFilter.<init>(DartConsoleFilter.java:44)
at io.flutter.run.SdkRunConfig.addConsoleFilters(SdkRunConfig.java:228)
at io.flutter.run.SdkRunConfig.getState(SdkRunConfig.java:194)
at io.flutter.run.SdkRunConfig.getState(SdkRunConfig.java:56)
SdkRunConfig.getState:
java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc.
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.intellij.util.SlowOperations.assertSlowOperationsAreAllowed(SlowOperations.java:114)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:153)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:98)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:267)
at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.findFileSetWithCustomData(WorkspaceFileIndexImpl.kt:250)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getModuleForFile(ProjectFileIndexImpl.java:102)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getModuleForFile(ProjectFileIndexImpl.java:95)
at com.intellij.openapi.module.ModuleUtilCore.lambda$findModuleForFile$0(ModuleUtilCore.java:84)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runReadAction(AnyThreadWriteThreadingSupport.kt:272)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runReadAction(AnyThreadWriteThreadingSupport.kt:262)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:66)
at com.intellij.openapi.module.ModuleUtilCore.findModuleForFile(ModuleUtilCore.java:84)
at io.flutter.run.SdkRunConfig.getState(SdkRunConfig.java:139)
at io.flutter.run.SdkRunConfig.getState(SdkRunConfig.java:59)