Search in sources :

Example 16 with VFileEvent

use of com.intellij.openapi.vfs.newvfs.events.VFileEvent in project intellij-community by JetBrains.

the class VirtualFilePointerTest method testManyPointersUpdatePerformance.

public void testManyPointersUpdatePerformance() throws IOException {
    LoggingListener listener = new LoggingListener();
    final List<VFileEvent> events = new ArrayList<>();
    final File ioTempDir = createTempDirectory();
    final VirtualFile temp = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioTempDir);
    for (int i = 0; i < 100000; i++) {
        myVirtualFilePointerManager.create(VfsUtilCore.pathToUrl("/a/b/c/d/" + i), disposable, listener);
        events.add(new VFileCreateEvent(this, temp, "xxx" + i, false, true));
    }
    PlatformTestUtil.startPerformanceTest("vfp update", 10000, () -> {
        for (int i = 0; i < 100; i++) {
            // simulate VFS refresh events since launching the actual refresh is too slow
            myVirtualFilePointerManager.before(events);
            myVirtualFilePointerManager.after(events);
        }
    }).useLegacyScaling().assertTiming();
}
Also used : MockVirtualFile(com.intellij.mock.MockVirtualFile) VFileEvent(com.intellij.openapi.vfs.newvfs.events.VFileEvent) ArrayList(java.util.ArrayList) VFileCreateEvent(com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent) MockVirtualFile(com.intellij.mock.MockVirtualFile) File(java.io.File)

Aggregations

VFileEvent (com.intellij.openapi.vfs.newvfs.events.VFileEvent)16 VFileCreateEvent (com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 BulkFileListener (com.intellij.openapi.vfs.newvfs.BulkFileListener)5 VFileContentChangeEvent (com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent)5 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)5 File (java.io.File)4 VFileDeleteEvent (com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent)3 GeneralSettings (com.intellij.ide.GeneralSettings)2 Application (com.intellij.openapi.application.Application)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 WriteAction (com.intellij.openapi.application.WriteAction)2 SystemInfo (com.intellij.openapi.util.SystemInfo)2 FileAttributes (com.intellij.openapi.util.io.FileAttributes)2 FileSystemUtil (com.intellij.openapi.util.io.FileSystemUtil)2 FileUtil (com.intellij.openapi.util.io.FileUtil)2 IoTestUtil (com.intellij.openapi.util.io.IoTestUtil)2 StringUtil (com.intellij.openapi.util.text.StringUtil)2 com.intellij.openapi.vfs (com.intellij.openapi.vfs)2 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)2