优化问题

type  myrecord = record      x,y,z:integer;  end; var     lst:tlist<myrecord>;     a:integer; begin     a := lst[0].x;     a: = lst.list[0].x end;

    a := lst[0].x;     a: = lst.list[0].x  这两个 那个速度快?

 第二个会快很多(很多也是比对第一个,如果和整体比占多少才是对效率提高多少)

因为第一个会产生一次隐含的record复制

 隐含的record复制是因为哪个原因引起的,是因为default? ,还是因为这个?

因为属性多赋值了中间值的Result?

平时没注意这个。。。看来以后要少用带索引的属性。

原文地址:https://www.cnblogs.com/marklove/p/12688502.html