ergoemacs / ergoemacs-mode

ergoemacs-mode
ergoemacs.github.io/
GNU General Public License v3.0
293 stars 35 forks source link

It's Slowing down my Emacs #315

Closed shahinism closed 9 years ago

shahinism commented 10 years ago

Hi, it seems that ergoemacs is slowing down my emacs too much. When I open a file with more than hundred lines, the cursor will glitch while moving around. It also affected my Emacs startup time. Is there anyway to reduce some of ergoemacs functionality and get my speed back?

I just have a regular installation.

mattfidler commented 10 years ago

Is this something new?

There is a highly experimental feature that possibly addresses the movement.

Have you seen differences when using the arrow keys or just the M-i style keys? On Sep 29, 2014 4:02 PM, "Shahin Azad" notifications@github.com wrote:

Hi, it seems that ergoemacs is slowing down my emacs too much. When I open a file with more than hundred lines, the cursor will glitch while moving around. It also affected my Emacs startup time. Is there anyway to reduce some of ergoemacs functionality and get my speed back?

I just have a regular installation.

— Reply to this email directly or view it on GitHub https://github.com/ergoemacs/ergoemacs-mode/issues/315.

shahinism commented 10 years ago

Yes, you are right! When I use arrow keys, the cursor is moving really better.

mattfidler commented 10 years ago

I'm not sure what to do to debug the startup time. I thought elp would work, but it doesn't work for me.

mattfidler commented 10 years ago

Wait, I did get it to work.

If you add:

(require 'ergoemacs-mode)
(require 'elp)
(elp-instrument-package "ergoemacs-")

Then, after loading emacs, type in Alt+a elp-results

I get:

ergoemacs-get-fixed-map                                 8761        32.692000000  0.0037315374
ergoemacs-mode                                          12          27.415000000  2.2845833333
ergoemacs-setup-keys                                    7           26.401999999  3.7717142857
ergoemacs-theme-install                                 7           26.393        3.7704285714
ergoemacs-theme-obj-install                             12          23.266000000  1.9388333333
ergoemacs-define-map                                    1910        16.998999999  0.0088999999
ergoemacs-theme-reset                                   5           10.719        2.1437999999
ergoemacs-flatten-composed-keymap                       333         9.7799999999  0.0293693693
ergoemacs-is-movement-command-p                         677         9.041         0.0133545051
ergoemacs-translate                                     823         8.1590000000  0.0099137302
ergoemacs-theme-get-component                           594         7.8400000000  0.0131986531
ergoemacs-set-default                                   4           7.8159999999  1.9539999999
ergoemacs-pretty-key                                    11897       7.5430000000  0.0006340253
ergoemacs-unicode-char                                  173026      4.6379999999  2.68...e-005
ergoemacs-theme-get-obj                                 14          3.9229999999  0.2802142857
ergoemacs-theme-component--create-component             42          3.9039999999  0.0929523809
ergoemacs-define-key                                    534         3.8889999999  0.0072827715
ergoemacs-display-char-p                                169476      3.7179999999  2.19...e-005
ergoemacs-theme-component--with-hook                    30          3.2899999999  0.1096666666
ergoemacs-apply-inits                                   172         3.1109999999  0.0180872093
ergoemacs-flatten-composed-keymap--define-key           2821        2.9169999999  0.0010340304
ergoemacs-translation-install                           3292        2.4939999999  0.0007575941
ergoemacs-get-hooks                                     8540        2.0929999999  0.0002450819
ergoemacs-theme--install-shortcuts-list                 106         1.6719999999  0.0157735849
ergoemacs-theme--install-shortcut-item                  12084       1.6229999999  0.0001343098
ergoemacs-shortcut-remap-list                           9541        1.0819999999  0.0001134053
ergoemacs-get-keymaps-for-hook                          279         1.0659999999  0.0038207885
...
mattfidler commented 10 years ago

I suppose I could cache the calculated ergoemacs-mode object to allow faster startup times.

mattfidler commented 10 years ago

I turned off the cache again. It is still unstable.

mattfidler commented 10 years ago

Moving down in ergoemacs-shortcuts, I get the following profile:

ergoemacs-read-key                                      63          15.514999999  0.2462698412
ergoemacs-shortcut-remap                                64          14.585000000  0.2278906250
ergoemacs-read-key-lookup                               64          14.392000000  0.2248750000
ergoemacs-read-key-call                                 64          13.888000000  0.2170000000
ergoemacs-read-key-default                              2           10.006        5.003
ergoemacs-shortcut-movement                             60          5.5130000000  0.0918833333
ergoemacs-shortcut-movement-no-shift-select             60          5.5120000000  0.0918666666
ergoemacs-shortcut---internal                           61          5.5100000000  0.0903278688
...
ghost commented 10 years ago

This is what I get on GNU Emacs 24.3.1, ErgoEmacs (latest commit, f18a360045642b0d27c6afdf32cdab3c2a8cb49d) and Trisquel GNU/Linux:

https://gist.github.com/akfoss/117ddf6b62a20faea56c

mattfidler commented 10 years ago

I have an idea, but it would take some work. Please be patient. I will create a new branch soon.

mattfidler commented 10 years ago

See Branch:

https://github.com/ergoemacs/ergoemacs-mode/tree/speed

mattfidler commented 9 years ago

You can also try downgrading to the stable version. It has better speed. See Issue #322 for a report.

The stable version is here:

http://elpa.gnu.org/packages/ergoemacs-mode

mattfidler commented 9 years ago

@xahlee, would you mind if I downgrade the master trunk to the latest stable.

xahlee commented 9 years ago

ugh, just saw this. Hope all's well...

mattfidler commented 9 years ago

I've been strapped for time, but the branch that takes care of the speed issues is nearer completion. Isearch is working well. I'm still having troubles with setting up ergoemacs-keys at the right time for major modes. There is no standard for when the keys are setup.

mattfidler commented 9 years ago

The lastest unstable master branch addresses this issue.

It speeds up ergoemacs-mode by the following:

The first startup is brutal of this package is brutal, but it saves time after initial startup. In ergoemacs-mode it only sets up the enhanced unicode support if this has been cached.

See https://github.com/rolandwalker/unicode-fonts for more information.

ergoemacs-mode also now caches the keymap lookups for your configuration (and will invalidate the cache when it detects a configuration change). For me, this makes my initial startup time for emacs-mode key lookups ~ 14 seconds and the subsequent startup ~1 second. It also makes my interactive emacs sessions much more responsive.

Therefore, now I'm going to close this issue.

meteficha commented 9 years ago

I've installed the lastest unstable from ELPA. Why is it contacting ELPA on every startup? Is my setup wrong?

meteficha commented 9 years ago

For future reference: I had a line explicitly enabling ergoemacs. Removing it made everything work fine (so far). :)

meteficha commented 9 years ago

Sorry for the spam: @mlf176f2 I had to manually install smex otherwise M-a wouldn't work.

mattfidler commented 9 years ago

Smex shouldn't be required... When I run from a clean environment (C-h z), smex isn't installed and M-a works (It shows M-x but that is a separate issue)