This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Arrays within JavaScript files cause the UI to hang #493
Copy link
Copy link
Closed
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
[Description of the issue]
Steps to Reproduce
- Create a test.js file and save it.
- Copy and paste a large array into the file e.g.
var occupationArray = [['Accountant','Accountant'],['Actor/Performer','Actor/Performer'],['Admin/Data Entry/Secretary','Admin/Data Entry/Secretary'],['Air Traffic Controller','Air Traffic Controller'],['Ambulance Officer/Manager','Ambulance Officer/Manager'],['Architect','Architect'],['Artist/Designer/Illustrator','Artist/Designer/Illustrator'],['Assembler','Assembler'],['Baker/Pastry Cook','Baker/Pastry Cook'],['Barrister/Solicitor','Barrister/Solicitor'],['Building/Construction Manager','Building/Construction Manager'],['Bursar','Bursar'],['Butcher/Smallgoods','Butcher/Smallgoods'],['Caretaker/Janitor','Caretaker/Janitor'],['Cashier','Cashier'],['Catering/Restaurant Manager','Catering/Restaurant Manager'],['Childcare/Youth Worker','Childcare/Youth Worker'],['Clerical Worker','Clerical Worker'],['Consultant','Consultant'],['Coroner/Judge/Magistrate','Coroner/Judge/Magistrate'],['Customer Service Consultant','Customer Service Consultant'],['Customs Agent','Customs Agent'],['Defence Forces','Defence Forces'],['Dishwasher/Kitchenhand','Dishwasher/Kitchenhand'],['Doctor/Specialist/Surgeon','Doctor/Specialist/Surgeon'],['Driver/Operator','Driver/Operator'],['Electrical/Electronic Engineer','Electrical/Electronic Engineer'],['Engineer','Engineer'],['Executive','Executive'],['Farmer','Farmer'],['Fire Brigade/Police','Fire Brigade/Police'],['Gardener/Landscaper','Gardener/Landscaper'],['Greenkeeper/Groundsperson','Greenkeeper/Groundsperson'],['HR/Recruitment','HR/Recruitment'],['Historian','Historian'],['Home Duties','Home Duties'],['Hospitality','Hospitality'],['Hotel Manager/Supervisor','Hotel Manager/Supervisor'],['IT Professional','IT Professional'],['Importer/Exporter','Importer/Exporter'],['Instructor','Instructor'],['Journalist/Proofreader','Journalist/Proofreader'],['Lab Technician','Lab Technician'],['Labourer/Factory/Process Worker','Labourer/Factory/Process Worker'],['Landscape Artist','Landscape Artist'],['Legal Officer','Legal Officer'],['Librarian','Librarian'],['Logistics','Logistics'],['Maintenance Engineer','Maintenance Engineer'],['Manager/Supervisor','Manager/Supervisor'],['Mechanic','Mechanic'],['Medical Lab Technician','Medical Lab Technician'],['Musician','Musician'],['Nurse/Midwife','Nurse/Midwife'],['Nursery and Garden Labourer','Nursery and Garden Labourer'],['Pharmacist','Pharmacist'],['Politician','Politician'],['Production','Production'],['Professional Sportsperson','Professional Sportsperson'],['Public Relations','Public Relations'],['Public Servant','Public Servant'],['Real Estate/Property','Real Estate/Property'],['Researcher','Researcher'],['Retail/Small Business Manager','Retail/Small Business Manager'],['Retired','Retired'],['Safety Inspector','Safety Inspector'],['Sales Rep','Sales Rep'],['Sales/Marketing/Advertising','Sales/Marketing/Advertising'],['Scientist/Mathematician','Scientist/Mathematician'],['Security Services/Officer','Security Services/Officer'],['Self-Employed','Self-Employed'],['Social Worker','Social Worker'],['Sole Trader','Sole Trader'],['Sound Technician','Sound Technician'],['Student','Student'],['Teacher','Teacher'],['Translator','Translator'],['Travel Agent/Consultant','Travel Agent/Consultant'],['Unemployed','Unemployed'],['University Lecturer/Teacher','University Lecturer/Teacher'],['Veterinarian','Veterinarian'],['Volunteer Work','Volunteer Work'],['Wholesale Manager','Wholesale Manager'],['Writer/Editor','Writer/Editor']];- Or paste the array then try to save as .js
Expected behavior: The paste/save should only take a second or two to complete.
Actual behavior: The interface hangs, a message appears asking if you would like to wait. If you click wait enough times the paste/save will complete. Each time you touch the array this introduces an additional delay. The larger the array, the larger the delay.
Reproduces how often: 100%
Versions
Atom : 1.14.3
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
Windows 7x64 SP1
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
Activity
winstliu commentedon Feb 21, 2017
If I remember correctly arrays are the only "bracket" structure in language-javascript that doesn't use nesting. So it seems counterintuitive that this one out of all three would be the one to have performance issues.
helpfulBro commentedon Feb 21, 2017
Other larger arrays types e.g. Array = (string1, string2, string3); do not have the same issue. It seems specific the square brackets. Well for me anyway.
cayetanobv commentedon Feb 22, 2017
And highlighting does not work properly. You can see screenshot:

Array example:
winstliu commentedon Feb 22, 2017
That is intentional, or else you would have a seriously bad time editing files with long lines. As in, Atom would probably crash. It is a built-in limitation to Atom's tokenizing engine.
winstliu commentedon Feb 26, 2017
I've confirmed this as a regression after bisecting between v0.122.0 and master. @Alhadis the offending commit is 7eec645, which you committed.
EDIT: Specifically, it's the changes you made in the first half of the commit for getters and setters. It looks like the optional
get/setpart at the very beginning isn't that performant, because as soon as I make it required the performance is back to normal.Alhadis commentedon Feb 26, 2017
Sounds like a backtracking issue. Try this:
EDIT: Okay, nope, that alone isn't fixing it. I'll have a closer look.
helpfulBro commentedon Feb 27, 2017
Is there anything I can do within atom as a work around until this is included in a newer version?
Alhadis commentedon Feb 27, 2017
@halcy0n9001 Once #494 is merged, you can link the latest changes to the package by linking it locally:
Make sure to delete it after installing the next version of Atom which includes the fix.
helpfulBro commentedon Feb 27, 2017
@Alhadis
Thank you
Merge pull request #494 from Cutlery-Drawer/array-hang
winstliu commentedon Feb 27, 2017
I'll be looking into getting this included in the next hotfix release.
helpfulBro commentedon Feb 27, 2017
Thanks @50Wliu & @Alhadis for the quick turn-around 👍
winstliu commentedon Mar 3, 2017
(Forgot to mention this here, but the fix went out in 1.15.0-beta4.)