On Mon, Nov 23, 2020 at 10:20 AM Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> Em seg., 23 de nov. de 2020 às 11:02, Kyle Evans <kevans@freebsd.org> escreveu:
>>
>> On Mon, Nov 23, 2020 at 5:38 AM Ranier Vilela <ranier.vf@gmail.com> wrote:
>> >
>> > Em dom., 22 de nov. de 2020 às 18:13, Kyle Evans <kevans@freebsd.org> escreveu:
>> >> Note that any optimizing compiler worth its salt should be able
>> >> to identify that it can eliminate the strlen() call at the call sites
>> >> where it's a literal, providing a less-redundant interface that's
>> >> "optimal" (not that I think it's necessarily
>> >> worth it).
>> >
>> > I come from the old school, from the days of the MSDOS.
>> > From my first C course, one of the lessons was: don't leave anything behind.
>> > Indeed, compilers have evolved a lot.
>> > But the one who knows the code and the data best is the programmer, not the compiler.
>> > Then give permission to optimize and the compiler will do a better job.
>> > It is the same principle of using const, many do not, because the code is less readable.
>> >
>>
>> Sure, I'll bow out here.
>
> I would like, at least, once again, your opinion, in this example below, if you don't mind.
> When the programmer knows the data, better than the compiler.
>
> LUA API luaS_newshortstr
> 1. Avoid "if test" when the size of string is < LUAI_MAXSHORTLEN.
>
The patch below seems to be truncated in some sense, because it
doesn't seem to do what's just been described. Notably, the
description leads me to believe that it's supposed to eliminate some
branching, but that doesn't seem to have happened.
Btw, I think we should take this off-list if you'd like my input,
rather than adding more tangentially related e-mail during an ongoing
release cycle. Not to say that there's no educational value in this
discussion, but I suspect it would be greatly appreciated to converge
on some agreeable set of changes (or maybe even no changes, if it
works out that way) before revisiting the topic on-list.
Ok, I sent the patch to your email.
regards,
Ranier Vilela