optimization of TextLineData::attribute

Authored by jtamate on Mar 23 2018, 4:37 PM.

Description

optimization of TextLineData::attribute

Summary:
Use a binary search for the needed Attribute.
Also moved the implementation from the header.

From 76,84% of cpu

to 0.08% of cpu

in callgrind doing the following:

Open an XML file with 4 lines and a line of 566039 characters long.
Accept to reopen the file, move to the end of the file (ctrl+end), and close.

The time difference can also be noticed in the autotests.

Test Plan:
Open a XML file with 4 lines and a line of 566039 characters long.
Accept to reopen the file, move to the end of the file (ctrl+end), and close.

Reviewers: Frameworks, Kate, cullmann

Reviewed By: Kate, cullmann

Subscribers: anthonyfieroni, dhaumann, mwolff, cullmann

Tags: Kate, Frameworks

Differential Revision: https://phabricator.kde.org/D11487

Details

Committed
jtamateMar 23 2018, 4:38 PM
Reviewer
Kate
Differential Revision
D11487: optimization of TextLineData::attribute
Parents
R39:91999f6e9116: Don't calculate attribute() twice.
Branches
Unknown
Tags
Unknown