Bug 308657

Summary: Performance problem in KWrite::readConfig
Product: [Applications] kate Reporter: BRULE Herman <alpha_one_x86>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.10

Description BRULE Herman 2012-10-19 12:55:47 UTC
Hello, when I open 100x .cpp + .h file, I have very big performance problem. I need wait more than 90min to open it.
See the attached file to have the profile.
90% of the time is into KateGlobal::readConfig(KConfig*)
Read only one time this config, and general optimization in this case, can be useful for the user experience.
I'm under linux, with radeon HD 5450 with open source drivers.

Thanks to fix it, to have correct open of multiple file.

Reproducible: Always
Comment 1 BRULE Herman 2012-10-19 13:01:24 UTC
I'm under kde 4.8.5
http://files.first-world.info/temp/callgrind.out.4420.gz
Comment 2 Dominik Haumann 2012-10-20 11:35:45 UTC
What happens, if you open these 200 files in Kate instead of KWrite?
Comment 3 BRULE Herman 2012-10-20 15:30:55 UTC
No performance  problem with kate.
Comment 4 Dominik Haumann 2012-10-21 20:05:41 UTC
It's because KWrite calls the Editor's readConfig for each MainWindow. This is redundant, as the global config is the same for all main windows. So this should be done only once, as can be seen in the backtrace.

Pseudo backtrace:
KWrite::readConfig()
KWrite::readConfig(KSharedConfigPtr config)
KTextEditor::Editor::readConfig(config.data())
Comment 5 Dominik Haumann 2012-10-24 10:57:39 UTC
Git commit aac62d627e69d6cfc548bbfef1e85545c858c94e by Dominik Haumann.
Committed on 24/10/2012 at 12:55.
Pushed by dhaumann into branch 'master'.

Call Editor::readConfig() with KGlobal::config() as parameter only once

M  +3    -0    kwrite/kwriteapp.cpp
M  +6    -1    kwrite/kwritemain.cpp

http://commits.kde.org/kate/aac62d627e69d6cfc548bbfef1e85545c858c94e