|
From: Jan N. <jan...@gm...> - 2025-08-30 14:44:11
|
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. 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 |