[Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

Colomban Wendling lists.ban at xxxxx
Sun May 31 08:57:34 UTC 2015


Le 31/05/2015 07:41, Lex Trotman a écrit :
> On 31 May 2015 at 11:46, Lex Trotman <elextr at gmail.com> wrote:
>> On 31 May 2015 at 08:05, Thomas Martitz <kugel at rockbox.org> wrote:
>>> Am 30.05.2015 um 03:19 schrieb Matthew Brush:
>>>>
>>>>
>>>> Just because it's such a trivial search algorithm, using strstr() is much
>>>> more simple and probably more efficient than using Scintilla's API to find
>>>> text, […]
>>
>> So its almost certainly slower than strstr().
> 
> And on my system strstr() is a builtin that can use any hardware
> support available.

One thing that will make strstr() sound a lot less sexy is that you
probably actually want to find *words* rather than substrings.  Meaning
that if the word under the cursor is "i", you probably don't want to
highlight all "i"s in e.g. an identifier "highlighting", but only whole
words.  And while Scintilla search has the logic for this
(SCFIND_WHOLEWORD), it'd probably be annoying/redundant to re-do with
the same logic.

Apart that, yes, strstr() from an optimized libc like glibc will be hard
to beat without also using very smart optimization combined with use of
specialized CPU instruction sets.

Cheers,
Colomban


More information about the Devel mailing list