Repository navigation
What is new, in short:
- The whole cache in one memory. The keeper keeps everything in one
WebAssembly.Memory: its index, every body, its own budget. You can hand it a memory of your own (a virtual machine's RAM, say) withopenKeeper({ memory }), and it makes no other buffer at all. A thread gets that memory once and reads every body in it, including bodies placed later. - The keeper as a page file.
keeper.evict(name, view, flags)writes a page to the disk straight from where it lies, even in memory the keeper does not manage, andkeeper.restore(name, view)reads it back into place.dropforgets a page and its copy on the disk;evictAllwrites many pages in one go (straight from memory when they lie side by side) and tells you how many went out, so you only retry the rest. A page that did not go out leaves the name exactly as it was. The remote keeper can do both, naming a page by where it lies in memory both sides share. - Bodies on a frame boundary.
segmentAlignmakes every segment start on a boundary you choose (4 KiB by default), so a large body can be mapped straight into a program's pages without a copy. - Frames go to the browser at any size. All memory now has a fixed length, so
VideoFrame.copyTo,GPUQueue.writeTextureand OPFS take any body. There is no flag for it any more.
Fixed from 1.1:
- A large body being written to disk in parts is written once: a
savemeanwhile finishes the same write, adropstops it, andcloseends it, where before it could be written twice and its pack never freed. - The keeper forgets which worker reserved what once the reservation is committed or let go, instead of keeping it until the worker ends.
- A record replaced while its last reader left, or its writer committed or gave up, is let go of at once instead of holding its room until a later sweep.
- A body of its own segment written again smaller fits a full budget: the pages it no longer needs are given back.
- A channel refuses a request too large for its slots at once, instead of first waiting for a slot.
If you used 1.1: all threads of one program must use the same version again, because the shared layout changed (saved data on disk still opens). Changed from 1.1:
- A thread is handed
keeper.shared, now{ memory, root }, and nothing else:createReader({ shared, keeper }). - Removed, as there is nothing left for them to do:
keeper.segmentBuffers(), theannounceoption,reader.adopt(), theknownargument ofreserveandraise, therefusedUnseenandspareAddressBytesfigures, andreserveFlags({ fixed }).reserveFlagsnow refuses any option it does not know, so old code that still passesfixedfails loudly instead of quietly. keeper.reserveandKeeperCalls.reserveare(name, length, flags, place, writer?);raiseis(name). The offset inplaceis where the body lies in the memory, read as an unsigned number (place[P_OFFSET] >>> 0).- New:
createArena({ bytes, most })makes a memory for the keeper;createAccountMemorytakesmemoryto place its words in one, and its answer says where they start (at);figures().segmentFailurescounts ranges the memory refused.