AS3数组清空(转)

  有时候我们需要将某个数组清空或者说重置,我最常用的办法的是重新new一下,但是有人测试研究发现使用length=0的方法,执行效率是最高的,呵呵,原文如下:

_localArray.length = 0; // Reset the array to empty

Yesterday I was coding on a rather large application at work and I needed to reset an array I had that was stored as a member variable. My gut instinct was to just take the Array variable and set its length = 0. Although this worked I wasn't sure if it was the best way to reset an array in ActionScript 3. So I asked my friend Guy Wyatt and he sent me this performance benchmark using 100,000 iterations in an Array as a test to see the time it took to clear out this Array using various techniques.

Resetting an empty array over 100,000 iterations in a while(i--) loop
length = 0:  15 ms
splice:  157 ms
new:  145 ms

So it looks like my gut instinct was right to set the length to 0 to reset my Array. I know this isn't the most glamorous blog post but I do think it is important to think about these things while coding a large Flex application. Every little bit of optimization is crucial and can over all help yield a better functioning application.

 

虽然说是length和new 执行效率最高,但是执行完后的数组元素有没有被垃圾回收,这个暂时就不敢肯定了,看来有必要研究一下AS3的垃圾回收机制了。。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本系统实现一个物流管理系统。具体功能描述如下: 1. 系统其它信息管理:主要是针对系统的其他的信息进行管理,实现了系统的模块化的管理,系统的框架建设等信息的管理,具有系统的整合性功能的建立,支撑起整个系统的平台建设。 2. 采购管理:系统采购管理,是本平台的一个初始化工作的登记,通过系统用户的用料商品的采购,进行登记管理,能够让平台最初的信息登记做到信息化的统计,方便用户在后期对采购商品的查看管理。 3. 库存管理:库存管理主要是针对采购的物料信息进行入库和出库的管理,方便了用户对物料的登记管理。 4. 供应商管理:供应商信息的管理和登记,是本系统的第三方用户相关信息的登记功能,通过供应商信息的登记,能够方便企业对供应商的查找,快速进货。 5. 配送运输:配送运输是物流管理平台管理物流信息的一个重要的功能点,通过配送运输机制的建立,就能更好地对物流信息进行管理,进行物流信息一体化的建设工作。 6. 出库入库管理:出库入库的信息管理,是本系统建设的一个重要的功能,将采购的物料信息,进行出库入库的登记,入库后,可以新增物料信息的数量,并在出库后,进行数量的减少。 7. 单据查询:针对客户单据的信息进行管理,能够针对客户的物料结算单据,进行单据的查询和登记管理,方便企业对客户的单据,进行查询查看。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值