summaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-11-01 13:21:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-11-01 13:21:00 -0300
commite8c779736f3029df353038352c14c8ab63728811 (patch)
tree23f75fa455ec333677650198cd889b187228b735 /lstate.h
parent2fc6b55dae7a120b4272ca0e9c356d1f96053bd9 (diff)
downloadlua-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 'lstate.h')
-rw-r--r--lstate.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/lstate.h b/lstate.h
index f08c2355..ce337707 100644
--- a/lstate.h
+++ b/lstate.h
@@ -43,8 +43,6 @@
43** 'weak': tables with weak values to be cleared; 43** 'weak': tables with weak values to be cleared;
44** 'ephemeron': ephemeron tables with white->white entries; 44** 'ephemeron': ephemeron tables with white->white entries;
45** 'allweak': tables with weak keys and/or weak values to be cleared. 45** 'allweak': tables with weak keys and/or weak values to be cleared.
46** There is also a list 'protogray' for prototypes that need to have
47** their caches cleared.
48 46
49*/ 47*/
50 48
@@ -186,7 +184,6 @@ typedef struct global_State {
186 GCObject *weak; /* list of tables with weak values */ 184 GCObject *weak; /* list of tables with weak values */
187 GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ 185 GCObject *ephemeron; /* list of ephemeron tables (weak keys) */
188 GCObject *allweak; /* list of all-weak tables */ 186 GCObject *allweak; /* list of all-weak tables */
189 GCObject *protogray; /* list of prototypes with "new" caches */
190 GCObject *tobefnz; /* list of userdata to be GC */ 187 GCObject *tobefnz; /* list of userdata to be GC */
191 GCObject *fixedgc; /* list of objects not to be collected */ 188 GCObject *fixedgc; /* list of objects not to be collected */
192 /* fields for generational collector */ 189 /* fields for generational collector */