-
Notifications
You must be signed in to change notification settings - Fork 1
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
Still slower comparing to previouse Zen Coding #2
Comments
I can confirm this. The expanding speed depends on the file size. But this issue is different from emmetio/npp#2 If you try:
It takes about 2~3 seconds. But:
It can be expanded instantly. I have to dig in emmet code to find out where is the bottleneck. BTW, jN has builtin zen coding script. It is much faster than emmet too. |
Speed is not problem for more nested markup. But if cursor is totally outside or directly in
|
https://github.com/eight04/jn-npp-emmet/blob/master/src/emmet.js#L492
|
Hmm in file 1,2k lines (expand in the end) I get 3 bottleneck. Please put alert like I did and you will see that slow is between: Code:
|
|
Yep now see you find the same things:) |
https://github.com/emmetio/emmet/blob/v0.7.1/javascript/html_matcher.js |
I have ported the old matcher to emmet: https://github.com/eight04/emmet/tree/dev-matcher-zen-coding The old matcher should be 2x faster, but there are some tests that it couldn't pass. I will checkout if I can fix it without a performance decrease. I will also try to cache the matching result. It should be 3x faster. |
Now is better for 1k line, but for more (like 3k or 4k) is still problem (but in old ZC is the same). In practice the most imprtant is expanding directly before All news and good things from actual matcher (https://github.com/emmetio/emmet/blob/master/lib/assets/htmlMatcher.js) was ported? |
What are news and good things? Here is my implementation: https://github.com/eight04/jn-npp-emmet/tree/better-matcher Some changes:
Maybe it can be faster, by searching the closing tag first, then directly find open tag with |
I'm mean infos from comment:
This last version is acceptable, in 4k lines delay is not so much as in master branch. Unfortunately two |
That bug is fixed via 1e1b0f8 And yes, the matcher will search from current position, including zen coding one and mine. |
Another implementation: https://github.com/eight04/jn-npp-emmet/tree/quick-match It is faster than I expected 😮 |
When you use jN, take care about access to properties depending from text like View.text,View.anchor, View.pos. |
@eight04 This last is realy fast when we work on the end of document, but at the beginning slows. Even outsiade html, which was not happend in
Using some Workers can help in this situation? In HTML files (if its big) you can open more Workers and use different algoritms to find open/close tag, the fastest will returns value and others can be close. Additionally we will not have the locked UI (like now when action takes some time). |
I updated the algorithm and it should be better now. After some testing I will merge it into I don't think WSH support web worker. |
@sieukrem Emmet's author has mentioned this too (emmetio/npp#2). But actually I don't feel any delay in jN comparing to emmetio/npp plugin. Also, when can I use |
Look for usages of pos and anchor. I have seen a usage for save and restore of pos and anchor. In this case it does not make any difference if you use byte or character positions, but byte is faster. |
Dialog has access to Worker interface, I check this in your code (line ~109) but don't test it in more ways:
This last version is really fast, 4k lines its not a problem:). |
Unfortunately
|
12a73c7 |
I have released v1.0.0 with https://github.com/eight04/emmet/tree/dev-quick-match-2. The matcher will try not to scan the whole file but looking for nearing tag. It is faster if the cursor is nearing some tags having unique name. |
I make more test and see that this version is significantly slower when comparing to Zen Coding 0.7 + NppScripting (older version of jN). Still can be downloaded from http://docs.notepad-plus-plus.org/index.php?title=Plugin_Central#_188
For bigger files the differences are clearly in favor of the older implementation (especially for Expand Abbrevation). I check this for files with 500, 1000, 1500, 2000 lines and run command on last line. In future is there any chance to improve speed?
The text was updated successfully, but these errors were encountered: