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

boom!!! Here is a hack solution to make atom start faster. #4293

Closed
yongkangchen opened this Issue Nov 23, 2014 · 44 comments

Comments

Projects
None yet
@yongkangchen
Copy link
Member

yongkangchen commented Nov 23, 2014

LastUpdate:
Good news with atom v0.199.0: Opening editors is now significantly faster than previously releases


After discuss in why-is-atom-so-slow, I pull a request Better user experience for start atom: #4269.

Today, I do a deep review the atom source code, and find a hack solution to make atom start faster:
this is the final modify screen video demo:
https://drive.google.com/file/d/0B8i7zRr2bfCAV0NoeG50dURMaW8/view?usp=sharing

What It Is

It delay the config file load, and the packages load and active, which cost much time on start.
After change, atom only load and active the must packages on start, which is ui theme、syntax theme、tabs、status-bar、tree-view.
Then delay to load and active other package. Window and mainly package will show quickly.

How To Do:

1、open atom.js
for mac: /Applications/Atom.app/Contents/Resources/app/src/atom.js
for win8:

C:\ProgramData\chocolatey\lib\Atom.{replace to atom version}\tools\Atom\resources\app\src\atom.js  

2、replace the below function Atom.prototype.startEditorWindow
3、you can test and change the setTimeout time to adapt your computer.
4、notice that you should modify atom.js again after you update the atom.

    Atom.prototype.startEditorWindow = function() {
      var CommandInstaller, dimensions, maximize, resourcePath, safeMode, _ref;
      _ref = this.getLoadSettings(), resourcePath = _ref.resourcePath, safeMode = _ref.safeMode;
      CommandInstaller = require('./command-installer');
      CommandInstaller.installAtomCommand(resourcePath, false, function(error) {
        if (error != null) {
          return console.warn(error.message);
        }
      });
      CommandInstaller.installApmCommand(resourcePath, false, function(error) {
        if (error != null) {
          return console.warn(error.message);
        }
      });
      dimensions = this.restoreWindowDimensions();
      // this.loadConfig();    
      this.themes.loadBaseStylesheets();
      this.keymaps.loadBundledKeymaps();

      setImmediate((function(_this) {
        return function() {
          _this.themes.activatePackages();
          _this.packages.activatePackage("tabs");
          _this.packages.activatePackage("status-bar");
          _this.packages.activatePackage("tree-view");

          _this.loadConfig();
          setTimeout(function(){
            _this.packages.loadPackages();
            _this.packages.activate();
            if (!safeMode) {
              _this.requireUserInitScript();
            }
            _this.subscribe(_this.config.onDidChange('core.autoHideMenuBar', (function(_this) {
              return function(_arg) {
                var newValue;
                newValue = _arg.newValue;
                return _this.setAutoHideMenuBar(newValue);
              };
            })(_this)));
            if (_this.config.get('core.autoHideMenuBar')) {
              _this.setAutoHideMenuBar(true);
            }
          }, 300); //NOTE: here can change
        };
      })(this));

      // this.packages.loadPackages();
      this.deserializeEditorWindow();
      this.watchProjectPath();
      // this.packages.activate();
      this.keymaps.loadUserKeymap();
      // if (!safeMode) {
      //   this.requireUserInitScript();
      // }
      this.menu.update();
      // this.subscribe(this.config.onDidChange('core.autoHideMenuBar', (function(_this) {
      //   return function(_arg) {
      //     var newValue;
      //     newValue = _arg.newValue;
      //     return _this.setAutoHideMenuBar(newValue);
      //   };
      // })(this)));
      // if (this.config.get('core.autoHideMenuBar')) {
      //   this.setAutoHideMenuBar(true);
      // }
      maximize = (dimensions != null ? dimensions.maximized : void 0) && process.platform !== 'darwin';
      return this.displayWindow({
        maximize: maximize
      });
    };

@yongkangchen yongkangchen changed the title :boom: Here is a hack solution to make atom start faster. boom!!! Here is a hack solution to make atom start faster. Nov 23, 2014

@cherry0199

This comment has been minimized.

Copy link

cherry0199 commented Nov 24, 2014

Great!
THANKS A LOT

@picibucor

This comment has been minimized.

Copy link

picibucor commented Nov 24, 2014

It is not working under win. I installed atom with chocolatey.

@yongkangchen

This comment has been minimized.

Copy link
Member Author

yongkangchen commented Nov 24, 2014

@picibucor I update the win8 path

@yongkangchen

This comment has been minimized.

Copy link
Member Author

yongkangchen commented Nov 28, 2014

Updated, use _this.themes.activatePackages(); replace for specify theme name.

@yongkangchen

This comment has been minimized.

Copy link
Member Author

yongkangchen commented Nov 28, 2014

Also add a gist about the hack code: https://gist.github.com/yongkangchen/86f0284291584d0b7c78

@xpol

This comment has been minimized.

Copy link

xpol commented Dec 9, 2014

Mac (10.10.1) says that my Atom app are broken and suggest me delete it after modified atom.js...

@yongkangchen

This comment has been minimized.

Copy link
Member Author

yongkangchen commented Dec 9, 2014

@xpol Apple menu > System Preferences… > Security & Privacy > General tab under the header "Allow applications downloaded from:" try set it to Anywhere?

@xpol

This comment has been minimized.

Copy link

xpol commented Dec 9, 2014

@yongkangchen That woks, thanks.

@nijikokun

This comment has been minimized.

Copy link

nijikokun commented Dec 17, 2014

👍

@tomkersnick

This comment has been minimized.

Copy link

tomkersnick commented Dec 24, 2014

Thanks for posting this. Extremely helpful.

This decreased the package loading by 200ms. I'm using Yosemite release 10.10.1 mbp retina 2.5GHz quad-core Intel Core i7.

@bthusby

This comment has been minimized.

Copy link

bthusby commented Dec 30, 2014

Will this go into an Atom version soon?

@jarig

This comment has been minimized.

Copy link

jarig commented Dec 31, 2014

Decreased load time significantly for me 👍

@bthusby

This comment has been minimized.

Copy link

bthusby commented Dec 31, 2014

Goody :)

@MartinLichtblau

This comment has been minimized.

Copy link

MartinLichtblau commented Jan 3, 2015

Thx!
But why is Atom loading the whole recursive file structure if I click only on one file, that's a big waste of performance.

@alxyang

This comment has been minimized.

Copy link

alxyang commented Jan 19, 2015

helped me out greatly, thank you.

@nijikokun

This comment has been minimized.

Copy link

nijikokun commented Jan 30, 2015

@lmartins

This comment has been minimized.

Copy link

lmartins commented Feb 21, 2015

Thank you, this does improve things for me too.

@patrickgilmour

This comment has been minimized.

Copy link

patrickgilmour commented Mar 14, 2015

Dramatically faster on MacBook Air (2011) with 1.8 GHz Intel Core i7 - thanks!

@yongkangchen

This comment has been minimized.

Copy link
Member Author

yongkangchen commented May 15, 2015

Since v0.193.0: Atom now ships its main code bundle as an asar archive file, so this hack will only work before v0.193.0, have not find how to hack asar file.

And good news with atom v0.199.0: Opening editors is now significantly faster than previously releases.

@orliesaurus

This comment has been minimized.

Copy link

orliesaurus commented May 15, 2015

it's still quite slow compared to Sublime, but thanks for putting this in the new release :)

@OwenMelbz

This comment has been minimized.

Copy link

OwenMelbz commented Mar 22, 2016

Is this fix still relevant in the latest releases? Or are there any mods that replicate the deferred loading?

@cscuderi

This comment has been minimized.

Copy link

cscuderi commented Mar 29, 2016

I came here wondering the same thing as @OwenMelbz. Is this still relevant?

@rnarian

This comment has been minimized.

Copy link

rnarian commented Apr 1, 2016

@OwenMelbz @cscuderi Apparently not: #4293 (comment) 😞

@JosueB

This comment has been minimized.

Copy link

JosueB commented May 25, 2016

Anyone tried doing this on windows 7? I found the atom.js file but it only has the following.

var path  = require('path');
var spawn = require('child_process').spawn;

var atomCommandPath = path.resolve(__dirname, '..', '..', 'atom.exe');
var arguments = process.argv.slice(2);
arguments.unshift('--executed-from', process.cwd());
var options = {detached: true, stdio: 'ignore'};
spawn(atomCommandPath, arguments, options);
process.exit(0);
@yogeshnikam

This comment has been minimized.

Copy link

yogeshnikam commented Jan 11, 2017

I am also getting the above one. for windows 7

@yogeshnikam

This comment has been minimized.

Copy link

yogeshnikam commented Jan 11, 2017

Can any one tell me how to increase the speed for windows 7 using the below code,
var path = require('path');
var spawn = require('child_process').spawn;

var atomCommandPath = path.resolve(__dirname, '..', '..', 'atom.exe');
var arguments = process.argv.slice(2);
arguments.unshift('--executed-from', process.cwd());
var options = {detached: true, stdio: 'ignore'};
spawn(atomCommandPath, arguments, options);
process.exit(0);

@VentGrey

This comment has been minimized.

Copy link

VentGrey commented Mar 8, 2017

D: how about Linux users? config is not the same :(

@ghost

This comment has been minimized.

Copy link

ghost commented Mar 8, 2017

+1 for Linux support if possible. Great work on this!

@Just4Ease

This comment has been minimized.

Copy link

Just4Ease commented May 1, 2017

Can't find the config for Ubuntu.

@csvan

This comment has been minimized.

Copy link

csvan commented May 15, 2017

I hate to be negative, but it's been almost 3 years since this (great!) hack was published, and Atom is still impossibly slow. IntelliJ IDEA with a lot of plugins literally starts faster for me despite being an entire IDE. Will this ever be fixed?

@50Wliu

This comment has been minimized.

Copy link
Member

50Wliu commented May 15, 2017

@csvan Atom 1.17.0, currently in beta, improves startup performance by around 50%.
http://blog.atom.io/2017/04/18/improving-startup-time.html

@seanfuture

This comment has been minimized.

Copy link

seanfuture commented Jun 19, 2017

That's nice @50Wliu - However it's still very slow relatively speaking ( not going to name competition ) as of 1.18.0. So please keep up the work on improving the start time - Thank you

@50Wliu

This comment has been minimized.

Copy link
Member

50Wliu commented Jun 20, 2017

Yeah, we're aware - future improvements are detailed at the bottom of the blog post.

@mittalyashu

This comment has been minimized.

Copy link

mittalyashu commented Aug 24, 2017

Why don't developers of the Atom re-develop the software in C++ and Python (just like sublime text) to make it faster?

@tommywalkie

This comment has been minimized.

Copy link

tommywalkie commented Sep 18, 2017

"Why don't developers just re-develop their app in several different languages ? They are so lazy." ( ͡° ͜ʖ ͡°)

@ishanray

This comment has been minimized.

Copy link

ishanray commented Oct 17, 2017

its still slow as of 1.21.1

@acrolink

This comment has been minimized.

Copy link

acrolink commented Oct 17, 2017

Which programming language is used to build Atom?

@OwenMelbz

This comment has been minimized.

Copy link

OwenMelbz commented Oct 17, 2017

@acrolink English

@acrolink

This comment has been minimized.

Copy link

acrolink commented Oct 18, 2017

@OwenMelbz , question edited.

@mittalyashu

This comment has been minimized.

Copy link

mittalyashu commented Oct 18, 2017

It is written in Javascript and CSS.
image

@OwenMelbz

This comment has been minimized.

Copy link

OwenMelbz commented Oct 18, 2017

Although it’s basically a glorified chrome plugin, so the actual underlying system is most likely in some sort of C derivative

@logankratos61

This comment has been minimized.

Copy link

logankratos61 commented Feb 22, 2018

for windows 10???

@BenjaminZekavica

This comment has been minimized.

Copy link

BenjaminZekavica commented May 23, 2018

Its work for the new version?

@lock

This comment has been minimized.

Copy link

lock bot commented Nov 19, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Nov 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.