网站首页  英汉词典

请输入您要查询的英文单词:

 

单词 Lazy initialization
释义

Lazy initialization

中文百科

惰性初始模式

在编程中, 惰性初始是一种拖延战术。在第一次需求出现以前,先延迟创建对象、计算值或其它昂贵进程。

这通常是以一个旗号来实现,用旗号来标示是否完成其程序。每次请求对象时,会先测试此旗号。如果已完成,直接传回,否则当场运行。

对于此想法更一般的论述,可见惰性求值。

对指令式语言,这个模式可能潜藏着危险,尤其是使用共享状态的程序习惯。

英语百科

Lazy initialization 惰性初始模式

In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.

This is typically accomplished by augmenting a variable's accessor method (or property definition) to check for a previously-created instance. If none exists a new instance is created, placed into the variable, and this new object is returned to the caller in a just-in-time fashion. In this manner object creation is deferred until first use which can, in some circumstances (e.g., sporadic object access), increase system responsiveness and speed startup by bypassing large-scale object pre-allocation. (Note that this may have attendant counter-effects on overall performance, however, as the impact of object instantiation is then amortized across the startup/warm-up phase of the system.)

随便看

 

英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。

 

Copyright © 2004-2024 encnc.com All Rights Reserved
更新时间:2025/6/23 16:38:57