[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT 2 clone-on-write for tables
- From: Tony Finch <dot@...>
- Date: Wed, 19 Jan 2011 18:46:44 +0000
On Wed, 19 Jan 2011, Alexander Gladysh wrote:
> Another silly question, while we're on it: is it possible, in theory,
> to create some magical "jit.tclone()" builtin, that would make such
> clone-on-write optimization possible?
You can do that with a proxy table. Point __index at the table to be
cloned, and when __newindex is called, copy everything to the proxy.
f.anthony.n.finch <email@example.com> http://dotat.at/
HUMBER THAMES DOVER WIGHT PORTLAND: NORTH BACKING WEST OR NORTHWEST, 5 TO 7,
DECREASING 4 OR 5, OCCASIONALLY 6 LATER IN HUMBER AND THAMES. MODERATE OR
ROUGH. RAIN THEN FAIR. GOOD.