|
From: <apn...@ya...> - 2025-08-30 17:03:56
|
> We don't want less efficient code in debug mode (in which the optimizer is disabled). So if I understand you correctly, the generated code in a release build is identical but your objection is that the debug builds are not? This is just absurd. Sorry. Turning off optimization generates so much rubbish code (from an efficiency point of view) that a couple of instructions are completely immaterial. Worrying about speed in a non-optimized build is something I have never ever heard of and that too in interpreters that are never really speed demons in any case. Being smart is not about bit twiddling any more. That time passed with the compilers that arrived about the turn of the century or before. Do as you please now that the code has been merged into the trunk. Revert the shifts, or not, whatever. Not a productive use of my time to go back and forth on this. /Ashok -----Original Message----- From: Jan Nijtmans <jan...@gm...> Sent: Saturday, August 30, 2025 8:14 PM To: apn...@ya... Cc: Tcl Core List <tcl...@li...> Subject: Re: [TCLCORE] CFV: TIP 726 Op za 30 aug 2025 om 06:43 schreef Ashok: > Regarding (1) - I'll come back later on this one. > Regarding (2) - > > It is not clear what you mean by more efficient when the compiled instruction stream is identical at least for clang x64 and gcc arm64. See <https://godbolt.org/z/8afa54eh3> https://godbolt.org/z/8afa54eh3. I wrote in the style I did because (in my mind of course) it was more natural and clearer to look up the bit in the mask than shifting the mask to look at the bit. I verified with only two compilers and architectures but see no reason to claim either shift would be more efficient. Compilers are smarter than me. More efficient means more efficient, so less instructions. Try the same experiment without the "-O2", an you will see that the non-optimized version is longer than the optimized one. The optimizer is smart enough to realize that a right-shift is better here, so it changes the left shift to a right-shift. The original author of the code in tclUtf.c was smart enough to realize this, and I realize it too. We don't want less efficient code in debug mode (in which the optimizer is disabled). I object to making such a change in existing code, without realizing what was behind it. You could have asked before. Sorry, Jan Nijtmans |