diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-11-01 13:21:00 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-11-01 13:21:00 -0300 |
commit | e8c779736f3029df353038352c14c8ab63728811 (patch) | |
tree | 23f75fa455ec333677650198cd889b187228b735 /lgc.h | |
parent | 2fc6b55dae7a120b4272ca0e9c356d1f96053bd9 (diff) | |
download | lua-e8c779736f3029df353038352c14c8ab63728811.tar.gz lua-e8c779736f3029df353038352c14c8ab63728811.tar.bz2 lua-e8c779736f3029df353038352c14c8ab63728811.zip |
Removed internal cache for closures
The mechanism of "caching the last closure created for a prototype to
try to reuse it the next time a closure for that prototype is created"
was removed. There are several reasons:
- It is hard to find a natural example where this cache has a measurable
impact on performance.
- Programmers already perceive closure creation as something slow,
so they tend to avoid it inside hot paths. (Any case where the cache
could reuse a closure can be rewritten predefining the closure in some
variable and using that variable.)
- The implementation was somewhat complex, due to a bad interaction
with the generational collector. (Typically, new closures are new,
while prototypes are old. So, the cache breaks the invariant that
old objects should not point to new ones.)
Diffstat (limited to 'lgc.h')
-rw-r--r-- | lgc.h | 4 |
1 files changed, 0 insertions, 4 deletions
@@ -164,9 +164,6 @@ | |||
164 | (isblack(p) && iswhite(o)) ? \ | 164 | (isblack(p) && iswhite(o)) ? \ |
165 | luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) | 165 | luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) |
166 | 166 | ||
167 | #define luaC_protobarrier(L,p,o) \ | ||
168 | (isblack(p) ? luaC_protobarrier_(L,p) : cast_void(0)) | ||
169 | |||
170 | LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); | 167 | LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); |
171 | LUAI_FUNC void luaC_freeallobjects (lua_State *L); | 168 | LUAI_FUNC void luaC_freeallobjects (lua_State *L); |
172 | LUAI_FUNC void luaC_step (lua_State *L); | 169 | LUAI_FUNC void luaC_step (lua_State *L); |
@@ -175,7 +172,6 @@ LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); | |||
175 | LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); | 172 | LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); |
176 | LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); | 173 | LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); |
177 | LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); | 174 | LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); |
178 | LUAI_FUNC void luaC_protobarrier_ (lua_State *L, Proto *p); | ||
179 | LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); | 175 | LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); |
180 | LUAI_FUNC void luaC_changemode (lua_State *L, int newmode); | 176 | LUAI_FUNC void luaC_changemode (lua_State *L, int newmode); |
181 | 177 | ||