`
isiqi
  • 浏览: 16033584 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

DELPHI性能优化的经验总结

阅读更多

1.

List.Count := RowCount;
HighRowIndex := RowCount-1;
for j:=0 to HighRowIndex do
begin
List[j] := ChildClass.Create;
end;//for j

for j:=0 to HighRowIndex do
begin
List.Add( ChildClass.Create);

end;//for j

要快, 有时95条记录前者不花时间, 而后者要花 0.015s

2.

TBizObjectClass(ChildClass)很慢, 所以不要在循环里面转换:

for j:=0 to HighRowIndex do
begin
List.Add( TBizObjectClass(ChildClass).Create);

end;//for j

应该改成:

ChildClass := TBizObjectClass(ChildClass);

for j:=0 to HighRowIndex do
begin
List.Add( ChildClass.Create);

end;//for j

注意这里的ChildClass 声明为TClass而不是TBizObjectClass.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics