Xcode 8's "Comment Selection" command is painfully slow

Originator:guillaume.algis
Number:rdar://28935025 Date Originated:
Status:Open Resolved:
Product:Developer Tools Product Version:8 GM, 8.1 beta (8T47)
Classification: Reproducible:Always
 
Summary:
Since Xcode 8, the "Comment Selection" command (under Editor > Structure, shortcut ⌘ + / ), was re-implemented as an App Extension. It seems the new implementation has a performance problem.

When applied to large chunks of code (say, more than 200 lines), the command is noticeably slow, and will block Xcode's main thread for a few seconds (!).

This is a regression from Xcode 7, where the implementation was fast enough that there was no noticeable freeze, even when commenting out large files.

Steps to Reproduce:
1. Launch Xcode 8
2. Open a large source file
3. Select more than 200 lines (the more you select, the more the lag will be noticeable)
4. Press ⌘/ to comment-out the selected lines
5. Make coffee and wait

Expected Results:
The lines are commented out instantly; there's no step 5.

Actual Results:
The lines are commented out after a few seconds of Xcode freezing and beachballing.

Version:
Xcode 8 GM
Xcode 8.1 beta (8T47)

Notes:


Configuration:
MacBookPro 11,1
Intel Core i5 2,6 GHz
8 Go RAM

OS X El Capitan 10.11.6 (15G1004)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!