"Cracking the Code: Can We Optimize This Delphi Loop for Better Performance?"

kr21

New member
Joined
Jan 5, 2008
Messages
3
Reaction score
0
Title: "Cracking the Code: Can We Optimize This Delphi Loop for Better Performance?"

Hey guys, I'm having a bit of a challenge with a Delphi loop that's eating up performance in my app. I've got a simple loop that's iterating over a 10k+ item list, doing some calculations and inserting data into a SQLite DB. Code is below, but I'm hoping one of you Delphi gurus can help me optimize this beast.

```delphi
for i := 0 to Length(myList) - 1 do
begin
DoSomeCalculation(item := myList);
MyDB.InsertRecord(myList);
end;
```
 

rmaksim

New member
Joined
Jul 27, 2005
Messages
4
Reaction score
0
"Yooo, I think I might've seen this before. Have you tried pre-allocating an array and using pointers to skip the extra memory allocation in each loop iteration? It could save you a decent amount of time if you're dealing with large datasets."
 
Top