[vfs] partial refresh optimization (IDEA-188926)

When a directory to refresh has no children, case-only rename event can't happen.
This commit is contained in:
Roman Shevchenko
2018-04-11 20:07:40 +02:00
parent bd9dffd341
commit a662f3c520
@@ -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<VirtualFile>, List<String>> result =
ReadAction.compute(() -> Pair.create(dir.getCachedChildren(), dir.getSuspiciousNames()));
ReadAction.compute(() -> pair(dir.getCachedChildren(), dir.getSuspiciousNames()));
List<VirtualFile> cached = result.getFirst();
List<String> wanted = result.getSecond();
OpenTHashSet<String> 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);