Search in sources :

Example 6 with VFileCreateEvent

use of com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent 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

VFileCreateEvent (com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent)6 VFileEvent (com.intellij.openapi.vfs.newvfs.events.VFileEvent)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 VFileMoveEvent (com.intellij.openapi.vfs.newvfs.events.VFileMoveEvent)2 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)2 MockVirtualFile (com.intellij.mock.MockVirtualFile)1 Application (com.intellij.openapi.application.Application)1 ModuleRootEvent (com.intellij.openapi.roots.ModuleRootEvent)1 ModuleRootListener (com.intellij.openapi.roots.ModuleRootListener)1 EmptyRunnable (com.intellij.openapi.util.EmptyRunnable)1 FileAttributes (com.intellij.openapi.util.io.FileAttributes)1 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)1 BulkFileListener (com.intellij.openapi.vfs.newvfs.BulkFileListener)1 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)1 VFileCopyEvent (com.intellij.openapi.vfs.newvfs.events.VFileCopyEvent)1 VFileDeleteEvent (com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent)1 VFilePropertyChangeEvent (com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1