From a662f3c520ae7583a4c1ff445335ae3027700ffd Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 11 Apr 2018 20:07:40 +0200 Subject: [PATCH] [vfs] partial refresh optimization (IDEA-188926) When a directory to refresh has no children, case-only rename event can't happen. --- .../vfs/newvfs/persistent/RefreshWorker.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/RefreshWorker.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/RefreshWorker.java index a09efb92b795..eb13cf743736 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/RefreshWorker.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/RefreshWorker.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vfs.newvfs.persistent; import com.intellij.openapi.application.ApplicationManager; @@ -261,13 +247,13 @@ public class RefreshWorker { while (true) { // obtaining directory snapshot Pair, List> result = - ReadAction.compute(() -> Pair.create(dir.getCachedChildren(), dir.getSuspiciousNames())); + ReadAction.compute(() -> pair(dir.getCachedChildren(), dir.getSuspiciousNames())); List cached = result.getFirst(); List wanted = result.getSecond(); OpenTHashSet actualNames = - fs.isCaseSensitive() ? null : new OpenTHashSet<>(strategy, VfsUtil.filterNames(fs.list(dir))); + fs.isCaseSensitive() || cached.isEmpty() ? null : new OpenTHashSet<>(strategy, VfsUtil.filterNames(fs.list(dir))); if (LOG.isTraceEnabled()) { LOG.trace("cached=" + cached + " actual=" + actualNames);