Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
This structure is used to make thousands of calculations in an algorithm like this:
for i:=1 to 900000 do
begin
CleartheList(MyList);
DotheMath(MyList);
DotheChart(MyList);
I am looking for a fast way to initializate the values of my TListSignals
to 0 and false
.
Now I am using this :
procedure ClearListSignals(var ListSignals:TListSignals);
i :Integer;
begin
for i := 0 to MaxSignalRecords - 1 do
with ListSignals[i] do
begin
signal1 :=0;
signal2 :=0;
signal3 :=0;
signal4 :=0;
signal5 :=0;
signal6 :=0;
bsignal1 :=false;
bsignal2 :=false;
bsignal3 :=false;
bsignal4 :=false;
bsignal5 :=false;
bsignal6 :=false;
How can I improve the performance of the ClearListSignals
procedure?
–
–
–
–
–
–
–
–
–
–
The SecureZeroMemory function fills a
block of memory with zeros. It is
designed to be a more secure version
of ZeroMemory.
Use this function instead of
ZeroMemory when you want to ensure
that your data will be overwritten
promptly, as the compiler can optimize
a call to ZeroMemory by removing it
entirely.
http://msdn.microsoft.com/en-us/library/aa366877%28v=vs.85%29.aspx
LE: here you have how to use it in Delphi if your version does not contain it:
Using SecureZeroMemory in Delphi
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.