From 880dd54504d3818b4fbd7b0c9cafc0a537cd68c0 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 19 Jan 2015 20:03:31 +0100 Subject: [PATCH] [performance optimization] use VirtualFile.getNameSequence() instead of VirtualFile.getName() --- .../openapi/vfs/newvfs/persistent/PersistentFSImpl.java | 2 +- .../src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java | 3 ++- .../jetbrains/python/psi/stubs/PySetuptoolsNamespaceIndex.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java index b1c3d90a8aed..bf91a747b948 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java @@ -1323,7 +1323,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone @NotNull @Override public CharSequence getNameSequence() { - return myParentLocalFile.getName(); + return myParentLocalFile.getNameSequence(); } @Override diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java index 1091f908b600..2245b5eae90b 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java @@ -25,6 +25,7 @@ package com.intellij.openapi.vcs.changes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; @@ -119,7 +120,7 @@ public class IgnoredFileBean { } else { // quick check for 'file' == exact match pattern - if (IgnoreSettingsType.FILE.equals(myType) && !myFilenameIfFile.equals(file.getName())) return false; + if (IgnoreSettingsType.FILE.equals(myType) && !StringUtil.equals(myFilenameIfFile, file.getNameSequence())) return false; VirtualFile selector = resolve(); if (Comparing.equal(selector, NullVirtualFile.INSTANCE)) return false; diff --git a/python/src/com/jetbrains/python/psi/stubs/PySetuptoolsNamespaceIndex.java b/python/src/com/jetbrains/python/psi/stubs/PySetuptoolsNamespaceIndex.java index 2988922415d2..a0bf1cceb943 100644 --- a/python/src/com/jetbrains/python/psi/stubs/PySetuptoolsNamespaceIndex.java +++ b/python/src/com/jetbrains/python/psi/stubs/PySetuptoolsNamespaceIndex.java @@ -16,6 +16,7 @@ package com.jetbrains.python.psi.stubs; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.indexing.*; @@ -58,7 +59,7 @@ public class PySetuptoolsNamespaceIndex extends ScalarIndexExtension { private FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() { @Override public boolean acceptInput(@NotNull VirtualFile file) { - return file.getName().endsWith(NAMESPACE_FILE_SUFFIX); + return StringUtil.endsWith(file.getNameSequence(), NAMESPACE_FILE_SUFFIX); } }; -- 2.23.3