Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install excruciatingly slow on Windows #179

Open
3 tasks
rbtcollins opened this issue Apr 9, 2022 · 3 comments
Open
3 tasks

Install excruciatingly slow on Windows #179

rbtcollins opened this issue Apr 9, 2022 · 3 comments

Comments

@rbtcollins
Copy link

Prerequisites

  • Can you reproduce the problem with Debug -> Reload Without Extensions?

No: this bug is about the installation process.

  • Did you perform a cursory search to see if your bug or enhancement is already reported?

Yes

Yes.

For more information on how to write a good bug report read here
For more information on how to contribute read here

Description

Installation is extremely slow. I did not capture exact times (but perhaps the installer leaves a log?), but it was well over 10 minutes, perhaps even 15 minutes.

I had brackets 1.something installed, from maybe 18months back.

The install brought up the UAC very quickly, and then moved into the progress bar, but it advanced excruciatingly slowly.

Runtime environment: Windows 11, SSD boot drive, Threadripper 2990WX, 128GB of RAM.

Steps to Reproduce

Not sure. My experience with bugs like this is that it may depend heavily on context.

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: [What you expected to happen]

Install should take a few seconds: the download is 84MB in size, and even a many-file heavy HTML tarball of that size can be unpacked in a few seconds with appropriate optimization to allow for antivirus and operating system inefficiencies.

Actual behavior: [What actually happened]

Install took many more seconds than that.

Versions

Please include the OS and what version of the OS you're running.
Please include the version of Brackets. You can find it under Help -> About Brackets (Windows and Linux) or Brackets -> About Brackets (macOS)
Release 2.0 build 2.0.1-17920 (master 7f6dffa)

@charlypa
Copy link
Member

charlypa commented Apr 9, 2022

@rbtcollins
Are you using SSD or HDD as a hard disk?

@charlypa
Copy link
Member

charlypa commented Apr 17, 2022

@rbtcollins
Apologies for not reading it thoroughly; you have a respective machine. One of the reasons for slow installation is that brackets have many small files for working bracket shells. Unpacking and copying it one by one takes time.

We are deprecating the bracket shell and migrating it to the electron. Once we migrate to electron, we will get better installation performance.

#112
You may also try out our new offerings Phoenix, a Browser-based IDE for the web. Once this project is in alpha, we will start our migration of brackets to electron
https://phcode.dev/
https://github.com/phcode-dev/phoenix

@rbtcollins
Copy link
Author

rbtcollins commented Apr 17, 2022

Thanks for the reply! So, I know file IO can be slow on windows, particularly if you're unpacking files that defender considers possible attack vectors (like HTML or JS).

That said, it is possible to get good performance - I'm one of the developers of rustup, and we went from many minutes to install documentation for rust to inconsequential delays. There is a youtube recording of my talk at LCA a couple years ago, but the tl;dr for low hanging fruit is that close() / CloseHandle can block - its where Defender Anti-Virus hooks in, and new files are quarantined on write, rather than later on read.

A rust toolchain's docs component has upwards of 20K files, which is significantly impacted by this behaviour. We've since been whitelisted by MS, but even without that we got to a decent place by shifting CloseHandle to not block extraction - we used a thread pool.

This could be as simple as converting a loop like (pseudocode)

while (!archive.eof()) {
    archive.extractMember();
}

into something like

let pool = new ThreadPool(machine.cpus);
while (!archive.eof()) {
    if (!archive.member.isFile()) {
            archive.extractMember();
     } else {
        (content, metadata) = archive.extractToMemory();
        let file = metadata.create();
        file.write(content);
        pool.execute(file => file.close());
    }
}

As an example, this is updating the nightly toolchain on the same machine I reported this bug from, still in Windows: the entire process, downloading the archives, deleting ~20K existing files, extracting ~20K new files, all takes 34s.

 time rustup toolchain update nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2022-04-17, rust version 1.62.0-nightly (878c7833f 2022-04-16)
info: downloading component 'rust-std' for 'wasm32-wasi'
info: downloading component 'rust-analysis'
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: downloading component 'rust-src'
info: downloading component 'rustc'
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rust-docs'
info: downloading component 'rustfmt'
info: removing previous version of component 'rust-std' for 'wasm32-wasi'
info: removing previous version of component 'rust-analysis'
info: removing previous version of component 'rust-std' for 'wasm32-unknown-unknown'
info: removing previous version of component 'rust-src'
info: removing previous version of component 'rustc'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rustfmt'
info: installing component 'rust-std' for 'wasm32-wasi'
info: installing component 'rust-analysis'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-src'
69 deferred IO operations
info: installing component 'rustc'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rust-docs'
69 deferred IO operations
info: installing component 'rustfmt'

  nightly-x86_64-pc-windows-msvc updated - rustc 1.62.0-nightly (878c7833f 2022-04-16) (from rustc 1.61.0-nightly (ee915c34e 2022-03-28))

info: checking for self-updates

real    0m34.109s
user    0m0.000s
sys     0m0.000s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants