Coder Social home page Coder Social logo

Slow when typing? about polymode HOT 16 CLOSED

demon386 avatar demon386 commented on July 19, 2024
Slow when typing?

from polymode.

Comments (16)

vspinu avatar vspinu commented on July 19, 2024

It is normal for big files. I haven´t implemented caching as yet. So, every
time you insert a character chunk detection is triggered.

How big is your file/chunk?

On 10 August 2013 07:06, Muchenxuan Tong [email protected] wrote:

The mode is great! But it became very slow when typing (not when I move
the cursor around).

Is it normal?


Reply to this email directly or view it on GitHubhttps://github.com//issues/7
.

from polymode.

demon386 avatar demon386 commented on July 19, 2024

The file is actually quite small, and it's way too slow.

I found turning off font-lock-mode will make it normal.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

It is a bug then. can you please attach your file?

On 10 August 2013 09:21, Muchenxuan Tong [email protected] wrote:

The file is actually quite small, and it's way too slow.

I found turning off font-lock-mode will make it normal.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-22435524
.

from polymode.

demon386 avatar demon386 commented on July 19, 2024

I don't think it's related to content of file.

In an Rmd file I can type

# dfdf dfdfdf _

It's fine till now. Then when a new line starts it becomes very slow.:

# dfdf dfdfdf
dfxx _

I guess it has something todo with font-lock.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

I have started developing polymode again by adding new markdown+brew+R RAPPORT mode (see #11). The speed problem turned to be the markdown handling of links fontification

I have informed the maintainer and, for the time being, I am removing markdown fontification hooks from polymode.

Could you please check that the speed issues have been resolved. Thanks.

from polymode.

demon386 avatar demon386 commented on July 19, 2024

Thanks for the work. However, for me it's still slow.

I've checked window-configuration-change-hook and after-change-functions in the buffer:

window-configuration-change-hook is a variable defined in `C source code'.
Its value is (linum-update-current t)
after-change-functions is a variable defined in `C source code'.
Its value is (jit-lock-after-change t)

from polymode.

vspinu avatar vspinu commented on July 19, 2024

There are no optimisation and no caching of any kind so far. That will come latter.

Is this a very old computer? I am on a 8 years old laptop and everything is very fast.

Could you please open subset.Rmd in tests directory, got into first paragraph and do M-x (benchmark-run 1000 (pm/get-innermost-span)). Same for the first code chunk {r test1}.

For me the first one is 0.44 seconds and the second is 0.25. So even without optimisation everything is infinitely fast.

from polymode.

demon386 avatar demon386 commented on July 19, 2024

I use a late-2011 MacBook Pro and shouldn't be that slow.

the result I got from running the benchmark

(0.252103 1 0.09603299999999848)

It's fast when browsing the file, but still slow when typing.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

Probably some weird interaction with some other mode. What else do you
have in post-command-hook?

I have (polymode-select-buffer t) in my local hook and the following in
global:

global-font-lock-mode-check-buffers
global-subword-mode-check-buffers
global-auto-complete-mode-check-buffers
smartparens-global-mode-check-buffers
sp--post-command-hook-handler

Just to make sure that it is polymode to blame. If you do

M-: (remove-hook 'post-command-hook 'polymode-select-buffer t)

do you observe any speed up while typing?

from polymode.

demon386 avatar demon386 commented on July 19, 2024

I tried to remove everything in post-command-hook and it's still slow.

Yet setting pm--dbg-fontlock to nil save my life, becoming insanely fast.

from polymode.

demon386 avatar demon386 commented on July 19, 2024

Ok. I've figured out. It has something todo with linum-mode. It's slow when global-linum-mode is enabled.

from polymode.

vspinu avatar vspinu commented on July 19, 2024

Thanks for figuring it out. I can reproduce. The difference is indeed
noticeable.

Linum is very heavy as it puts overlays on every line. Poly-mode
transfers overlays between indirect buffers. Will have to figure out a
workaround.

from polymode.

nstjhp avatar nstjhp commented on July 19, 2024

I also have this problem with linum-mode but in my case nothing ever appears until you move the cursor. Is there a line I can put in my .emacs to prevent global-linum-mode when I open a file in polymode e.g. .Rmd?

from polymode.

vspinu avatar vspinu commented on July 19, 2024

I plan to revisit polymode in the near features and to investigate this
issue more closely.

Each polymode has a hook. In this case poly-markdown+r-mode-hook. You
can use it to deactivate linum-mode.

Nick Pullen on Fri, 28 Feb 2014 04:56:50 -0800 wrote:

I also have this problem with linum-mode but in my case nothing ever appears
until you move the cursor. Is there a line I can put in my .emacs to prevent
global-linum-mode when I open a file in polymode e.g. .Rmd?


Reply to this email directly or view it on GitHub.

from polymode.

nverno avatar nverno commented on July 19, 2024

Thankyou for this thread! I had just about given up trying to use polymode because I couldn't figure this issue out. Might be useful to add a note about global-linum-mode to the warnings section of the readme.
Thanks for the great work

from polymode.

vspinu avatar vspinu commented on July 19, 2024

This one seem to have been finally fixed.

from polymode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.