Bug 215200

Summary: Reformat source tool causes editor to freeze for a moment
Product: [Applications] kdevelop Reporter: Diederik van der Boor <vdboor>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: reavertm
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Diederik van der Boor 2009-11-18 23:44:52 UTC
Version:           3.9.96 (beta6) (using KDE 4.3.3)
Compiler:          gcc
OS:                Linux (i686) release 2.6.31.5-0.1-desktop
Installed from:    openSUSE RPMs

When pressing the "reformat source" in the menu, the editor freezes for a brief moment.
Comment 1 Diederik van der Boor 2009-11-18 23:46:15 UTC
for the record, I actually expected some kind of progress feedback or threading so it doesn't look like kdevelop is broken.
Comment 2 Andreas Pakulat 2009-11-19 00:04:28 UTC
That doesn't make any sense. Reformatting formats the file you're currently working on, so blocking you from any input is quite fine. (Even though its more a side-effect of waiting for the external process to complete)
Comment 3 Diederik van der Boor 2009-11-27 00:10:17 UTC
Pardon me, would you consider reopening this?  I fully understand the editor component shouldn't be updated while running the reformatter. Completely locking up kdevelop for 5 seconds however, makes it look really broken.
Comment 4 Andreas Pakulat 2009-12-08 09:06:48 UTC
*** Bug 217801 has been marked as a duplicate of this bug. ***
Comment 5 Andreas Pakulat 2009-12-09 17:25:02 UTC
Apparently I underestimated what "moment" means, as the duplicate 217801 indicates this is along the lines of multiple seconds when astyle on the cli needs far less time.

I can see that too, kdevsvnplugin.cpp takes around 4-5 seconds here inside KDevelop to reformat with linux style. Whats noticeable is that reverting the change with Ctrl+Z takes about the same amount of time. So this might be a kate-issue... I'll try this too at home once I've finished the formatter-rewrite.
Comment 6 Milian Wolff 2010-11-05 16:07:47 UTC
definitely a kate issue, but it's only hit in kdevelop due to it's extensive usage of moving ranges / smart ranges. I'm currently trying to optimize what ever I can find and I think I already achieved a few dozen percents. But it's still far too slow...
Comment 7 Christoph Cullmann 2010-11-06 19:30:34 UTC
SVN commit 1193672 by cullmann:

mwolff:

    opt: use faster QHash for cache that has a ptr as key
    
    This makes reformat source in KDevelop a bit faster
    
CCBUG: 215200


 M  +1 -1      katetextblock.cpp  
 M  +1 -1      katetextblock.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1193672
Comment 8 Christoph Cullmann 2010-11-06 19:30:58 UTC
SVN commit 1193674 by cullmann:

mwolff:

    make TextRange::checkValidity faster by not doing and obsolete conversions
    
CCBUG: 215200


 M  +3 -3      katetextrange.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1193674
Comment 9 Christoph Cullmann 2010-11-06 19:32:40 UTC
SVN commit 1193676 by cullmann:

mwolff:
    provide fast TextCursor::setPosition(const TextCursor& position), esp. for TextRange::checkValidity()
    
CCBUG: 215200


 M  +13 -0     katetextcursor.cpp  
 M  +7 -0      katetextcursor.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1193676
Comment 10 Christoph Cullmann 2010-11-13 17:48:47 UTC
SVN commit 1196613 by cullmann:

merge milians latest performance tweaks
doc.clear() invalidates ranges

BUG: 215200


 M  +60 -62    document/katedocument.cpp  
 M  +43 -6     tests/katedocument_test.cpp  
 M  +72 -2     tests/movingrange_test.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1196613