Simplify/Speedup reading Stylesheet file
ClosedPublic

Authored by tcanabrava on Mon, Dec 3, 12:14 PM.

Details

Summary

read all of the information at once instead of concatenating
a QString over and over untill the end of the file. This removes
uneeded memory allocation and speeds up loading complex css files

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
tcanabrava created this revision.Mon, Dec 3, 12:14 PM
Restricted Application added a project: Konsole. · View Herald TranscriptMon, Dec 3, 12:14 PM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
tcanabrava requested review of this revision.Mon, Dec 3, 12:14 PM

Ok, I think I/someone read the docs and did it that way from the start - I wonder what the Qt docs thinks is a large file.


Reads the entire content of the stream, and returns it as a QString. Avoid this function when working on large files, as it will consume a significant amount of memory.

Calling readLine() is better if you do not know how much data is available.

That makes sense if you are processing the line and doing something with it
and discarding, but not appending to a string doing nothing with it until
the result is the whole file content. If what you want is the same as the
readAll, this one is faster as there’s no allocations for the temporary.

Em ter, 4 de dez de 2018 às 02:50, Kurt Hindenburg <
noreply@phabricator.kde.org> escreveu:

hindenburg added a comment. View Revision
https://phabricator.kde.org/D17329

Ok, I think I/someone read the docs and did it that way from the start - I
wonder what the Qt docs thinks is a large file.


Reads the entire content of the stream, and returns it as a QString. Avoid
this function when working on large files, as it will consume a significant
amount of memory.

Calling readLine() is better if you do not know how much data is available.

*REPOSITORY*
R319 Konsole

*REVISION DETAIL*
https://phabricator.kde.org/D17329

*To: *tcanabrava, hindenburg
*Cc: *konsole-devel, ngraham, maximilianocuria, hindenburg

hindenburg accepted this revision.Wed, Dec 5, 2:08 PM

Of course thanks

This revision is now accepted and ready to land.Wed, Dec 5, 2:08 PM
This revision was automatically updated to reflect the committed changes.