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

Lex Trotman elextr at xxxxx
Sun May 31 09:29:12 UTC 2015


On 31 May 2015 at 18:57, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> 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.

Sure you can, just do the strstr() thing then check those for wordiness :)

 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.
>

But yes, as much fun as imagining various premature optimising is,
using the existing code first to get it working then optimising *if
needed* is the real way to go.

Cheers
Lex

> 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
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel


More information about the Devel mailing list