Optimize reading Sonnet settings by minimizing the cals to save()

Review Request #123341 - Created April 12, 2015 and submitted

Information
Kåre Särs
sonnet
master
Reviewers
kdeframeworks
mlaurent, sandsmark

The curent implementation can causes ~25 cals to Settings::save() for every created Speller instance.

The Settings::restore() function ends with setQuietIgnoreList(...) which would call save() for evey ignore-word.

This patch removes the save() cals in the setFoo() functions of Settings and replace it by a boolean that indicates if the settign is changed or not. Then in the Speller class save() is called when needed.

The reason for this patch is that it took Kate ~2 minutes to open a kate session with ~340 files. The implementation in Kate called reload() for every file. There is a RR for Kate to remove that unneeded reload.

This patch also prepares Sonnet::Settings for being used in the public API to set aplication specific Sonnet settings without saving them in the global settings.

The Settings class is exported but the header is private. This change is BIC, but since the class is private, my interpretation is that it should not mater.

If accepted I will also add a Review Request to make the Settings class public to enable application specific settings.

Tested with Kate and with the patch the startup time was back to "normal".
Two unit tests added.

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
David Rosca
Laurent Montel
Kåre Särs
Kåre Särs
Kåre Särs
Milian Wolff
Vishesh Handa
Kåre Särs
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 28f74f1d4c6c0331df957463381d2f2b8936a801 by Kåre Särs to branch master.
Loading...