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

Poor performance in files with >1000 lines #16

Closed
Fank opened this issue Jan 22, 2015 · 18 comments
Closed

Poor performance in files with >1000 lines #16

Fank opened this issue Jan 22, 2015 · 18 comments

Comments

@Fank
Copy link

Fank commented Jan 22, 2015

I noticed this issue in some larger files, for example i save a file with 5000 lines it will take about to 60seconds to proceed the save.
Tested files where perl modules (.pm) and mason (.*).
My config is:

  "tabs-to-spaces":
    onSave: "tabify"
@lee-dohm
Copy link
Owner

Ouch ... that is an issue. I'll take a look at the code and see what I can do.

@Fank
Copy link
Author

Fank commented Jan 22, 2015

Here a detailed profile of the save process of a file with 5745 lines (~54seconds)
profile
And the the weired cpu usage during the save
htop

@lee-dohm
Copy link
Owner

So after looking at the code extensively, I have a couple optimizations in mind. Though I ran both a tabify and untabify on save on a 3,364 line file and it only took ~1.7 seconds for each. Can you give me some details about how deeply nested the lines are? What sort of hardware are you running on?

@Fank
Copy link
Author

Fank commented Jan 23, 2015

Hardware:

$ lspci 
00:00.0 Host bridge: Intel Corporation 5520 I/O Hub to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)
00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 13)
00:07.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 7 (rev 13)
00:10.0 PIC: Intel Corporation 7500/5520/5500/X58 Physical and Link Layer Registers Port 0 (rev 13)
00:10.1 PIC: Intel Corporation 7500/5520/5500/X58 Routing and Protocol Layer Registers Port 0 (rev 13)
00:11.0 PIC: Intel Corporation 7500/5520/5500 Physical and Link Layer Registers Port 1 (rev 13)
00:11.1 PIC: Intel Corporation 7500/5520/5500 Routing & Protocol Layer Register Port 1 (rev 13)
00:14.0 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub System Management Registers (rev 13)
00:14.1 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers (rev 13)
00:14.2 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub Control Status and RAS Registers (rev 13)
00:15.0 PIC: Intel Corporation 7500/5520/5500/X58 Trusted Execution Technology Registers (rev 13)
00:1a.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4
00:1a.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5
00:1a.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6
00:1a.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #2
00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller
00:1c.0 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 1
00:1c.5 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 6
00:1d.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1
00:1d.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2
00:1d.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3
00:1d.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90)
00:1f.0 ISA bridge: Intel Corporation 82801JIR (ICH10R) LPC Interface Controller
00:1f.2 RAID bus controller: Intel Corporation 82801 SATA Controller [RAID mode]
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5764M Gigabit Ethernet PCIe (rev 10)
0f:00.0 VGA compatible controller: NVIDIA Corporation G94GL [Quadro FX 1800] (rev a1)
28:00.0 VGA compatible controller: NVIDIA Corporation GT216GL [Quadro 400] (rev a2)
28:00.1 Audio device: NVIDIA Corporation GT216 HDMI Audio Controller (rev a1)
3e:00.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture Generic Non-Core Registers (rev 05)
3e:00.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture System Address Decoder (rev 05)
3e:02.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Link 0 (rev 05)
3e:02.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Physical 0 (rev 05)
3e:02.4 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Link 1 (rev 05)
3e:02.5 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Physical 1 (rev 05)
3e:03.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller (rev 05)
3e:03.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Target Address Decoder (rev 05)
3e:03.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller RAS Registers (rev 05)
3e:03.4 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Test Registers (rev 05)
3e:04.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Control Registers (rev 05)
3e:04.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Address Registers (rev 05)
3e:04.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Rank Registers (rev 05)
3e:04.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Thermal Control Registers (rev 05)
3e:05.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Control Registers (rev 05)
3e:05.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Address Registers (rev 05)
3e:05.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Rank Registers (rev 05)
3e:05.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Thermal Control Registers (rev 05)
3e:06.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Control Registers (rev 05)
3e:06.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Address Registers (rev 05)
3e:06.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Rank Registers (rev 05)
3e:06.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Thermal Control Registers (rev 05)
3f:00.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture Generic Non-Core Registers (rev 05)
3f:00.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture System Address Decoder (rev 05)
3f:02.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Link 0 (rev 05)
3f:02.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Physical 0 (rev 05)
3f:02.4 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Link 1 (rev 05)
3f:02.5 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Physical 1 (rev 05)
3f:03.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller (rev 05)
3f:03.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Target Address Decoder (rev 05)
3f:03.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller RAS Registers (rev 05)
3f:03.4 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Test Registers (rev 05)
3f:04.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Control Registers (rev 05)
3f:04.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Address Registers (rev 05)
3f:04.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Rank Registers (rev 05)
3f:04.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Thermal Control Registers (rev 05)
3f:05.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Control Registers (rev 05)
3f:05.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Address Registers (rev 05)
3f:05.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Rank Registers (rev 05)
3f:05.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Thermal Control Registers (rev 05)
3f:06.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Control Registers (rev 05)
3f:06.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Address Registers (rev 05)
3f:06.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Rank Registers (rev 05)
3f:06.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Thermal Control Registers (rev 05)

$ free -h
             total       used       free     shared    buffers     cached
Mem:           15G       5,6G        10G       117M       181M       2,3G
-/+ buffers/cache:       3,1G        12G
Swap:         3,9G         0B       3,9G

Its an HP Z600 Workstation

@Fank
Copy link
Author

Fank commented Jan 23, 2015

Here is an good example file: https://raw.githubusercontent.com/Fankserver/ArmA3-Missions/master/%5BFS%5Dco16_Altis_Kart.Altis/mission.sqm

Enter a new line somewhere and save

@Fank
Copy link
Author

Fank commented Jan 23, 2015

Here is a better example http://code.jquery.com/jquery-git2.js

@lee-dohm
Copy link
Owner

Thanks! I'll take a look at them this weekend!

On Jan 23, 2015, at 9:33 AM, Florian Kinder [email protected] wrote:

Here is a better example http://code.jquery.com/jquery-git2.js


Reply to this email directly or view it on GitHub.

@lee-dohm
Copy link
Owner

Even tabifying the large JS file only took 3.15s on my machine. I've got a brand-new Core i7 and 32GB of RAM, so maybe that has something to do with it. I have a couple optimizations in mind.

@Fank
Copy link
Author

Fank commented Jan 26, 2015

Tested with 0.8.1 no change still slow

@lee-dohm
Copy link
Owner

Yes, v0.8.1 was for eliminating deprecations. I'm still investigating the performance as I can, though it appears that the majority of time is spent outside of my code. My current recommendation if you have large files that you're commonly working on is to disable the on-save behavior and only normalize manually.

@Fank
Copy link
Author

Fank commented Mar 18, 2015

Tested with http://code.jquery.com/jquery-git2.js and version 0.9.0 -> 4498ms on windows

@lee-dohm
Copy link
Owner

lee-dohm commented May 2, 2015

The Atom team is working on a rewrite of the internals of Atom's text processing system which should help the find-and-replace performance when it gets integrated:

https://github.com/atom/text-document

@robhicks
Copy link

robhicks commented Jun 2, 2015

I am having the same problems, and if it took 60 seconds, I'd feel fortunate. I'm running on a Macbook Pro 16GB, i7.

My files are not highly nested. Most of the ones where I have problems are test data files with a lot of JSON, some ranging 10K - 20K lines.

@ghost
Copy link

ghost commented Jun 12, 2015

Same problem here, it even leads to atom freezing and requiring forced kill.
Please try on this file: http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng
Steps: delete a large chunk of text (~400 lines), then save (when option "untabify on save")

Maybe we could add a warning of possible performance issues beside the option?

@lczech
Copy link

lczech commented Jun 12, 2015

Thanks @andya9 for referencing my issue from the atom thread. Looking forward to a solution ;-) For now, I follow the advice to disable the on-save functionality.

@Fank
Copy link
Author

Fank commented Oct 2, 2015

@lee-dohm I can confirm its much faster. Changing ~5000 lines takes about 10-15 sec that is ok for me.
You can close this issue if you want.

@lee-dohm
Copy link
Owner

lee-dohm commented Oct 3, 2015

Thanks for the update, @Fank! I'll go ahead and close it then. As the find-and-replace performance gets better, so will this.

@lee-dohm
Copy link
Owner

As detailed in #41, I had to revert my performance optimization. I've opened #43 to track the need to create a configuration option to select between the two.

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

No branches or pull requests

4 participants