Lua: implement 'memoize' pattern for fiber userdata.
Creating a new userdata object whenever a fiber is accessed is inefficient and complicates fiber garbage collection: if a fiber is referenced to by multiple userdata instances, it's hard to know when to free it up. Implement 'memoize' pattern for fiber userdata to deal with these two issues. After this patch, no matter how and where from one gets a reference to a fiber, it's the same userdata object. As a side effect, getting fiber identity in Lua is also easy -- one can just directly compare two fibers to tell whether or not they are the same.
Loading
Please register or sign in to comment