You are not logged in.
Pages: 1
Hi,
Trying to save as many CPU cycles as possible.
Using OnKeyPress event of a TEdit. Want to Check if Key is 'x' character (case insensitive). CharCase property of the component is ecNormal. Current code is:
if SynCommons.UpperCase(Key) = 'X' then
begin
end;
I have checked UpperCase function and it seems to do lots of things inside. I have changed my code as follows:
if Key = 'x' or Key = 'X' then
begin
end;
However, I do wonder if there is any code that can be proposed to execute faster.
Thanks.
Offline
The 2nd version would be faster, indeed.
But I'm sure you are making premature optimization, here.
https://en.wikipedia.org/wiki/Program_o … o_optimize
You should not optimize such code lines, which are not run often.
Use a profiler to show the real bottlenecks of your app, then optimize only what is needed.
Offline
I could only find ProDelphi myself.
What other profiler(s) are available free for Delphi 10 which I may try?
Offline
Offline
Pages: 1