mwolff added a subscriber: dhaumann. mwolff added a comment.
Looking at `TextLineData::addAttribute`, it doesn't seem to sort the data - how can you be sure that the attributes list really is sorted by `offset + length`? I think this should be done manually there, or at least asserted. The old code apparently also relied on the order of attributes after all. @cullmann @dhaumann: can we have overlapping attributes? If so, then this opens another can of worms when we start to use binary searches over *ranges*. Note that we could think about an alternative (could also be combined with your patch) approach to speeding up this function: Pass around the previously found position. The way I guess this hotspot arises is that some function calls attribute on every pos in the line, linearly. We can leverage this and continue from where we left off the last time we returned. Really, I'd like to get my hands on one of your large XML files to play around with this myself :) REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D11487 To: jtamate, #frameworks, #kate Cc: dhaumann, mwolff, cullmann, michaelh, kevinapavew, ngraham, demsking, sars