[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Most efficient way to recognize a line by its first (up to) three characters
- From: meino.cramer@...
- Date: Tue, 11 Mar 2014 19:49:28 +0100
Enrico Colombini <erix@erix.it> [14-03-11 19:44]:
> On 11/03/2014 19.14, meino.cramer@gmx.de wrote:
> >There are either a one character or a two character or a three
> >character code at the beginning of each line, which tells me about
> >the kind of data to expect after that code.
>
> P.S. In that case I adapt my previous suggestion: you could use
> string.byte(s) to get the code of the first character, then (if needed)
> string.byte(s, 2) for the second and string.byte (s, 3) for the third
> one.
>
> Also, using a local will save table accesses:
>
> local charcode = string.byte
>
> I am currently squeezing out the last CPU cycles from an 8-bit MCU, so
> I am in the right mood for optimization, even if probably unneeded ;-)
>
> --
> Enrico
>
I know this...it is called 'the deep hack mode'...either
one knows it...or not. It is far beyond what can be explained.
Or in other words...
"There is a difference between knowing the path & walking the path." - Morpheus
;)