Skip to content

Releases

Cellar v1.2.0

Choose a tag to compare

@github-actions github-actions released this 01 Dec 03:01

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) with openKeeper({ 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, and keeper.restore(name, view) reads it back into place. drop forgets a page and its copy on the disk; evictAll writes 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. segmentAlign makes 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.writeTexture and 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 save meanwhile finishes the same write, a drop stops it, and close ends 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(), the announce option, reader.adopt(), the known argument of reserve and raise, the refusedUnseen and spareAddressBytes figures, and reserveFlags({ fixed }). reserveFlags now refuses any option it does not know, so old code that still passes fixed fails loudly instead of quietly.
  • keeper.reserve and KeeperCalls.reserve are (name, length, flags, place, writer?); raise is (name). The offset in place is 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; createAccountMemory takes memory to place its words in one, and its answer says where they start (at); figures().segmentFailures counts ranges the memory refused.

Cellar v1.1.1

Choose a tag to compare

@github-actions github-actions released this 30 Nov 01:01

Two fixes found while building a video editor on Cellar:

  • Cellar loads in an AudioWorklet. Importing the library made a text decoder at once, and an AudioWorklet has none, so a worklet that imported Cellar never registered. Nothing is taken from the host until it is used; a worklet reads a ring from its process() with drain or peek, never a wait.
  • Large frames handed to the browser. VideoFrame.copyTo, GPUQueue.writeTexture and OPFS refuse memory that can grow, and a body larger than a quarter of segmentBytes was placed in memory that can. A body reserved with reserveFlags({ fixed: true }) now always lies in fixed memory, up to a whole segment; one larger is refused at once. A 4K frame needs segments of 32 MiB, not 128 MiB.

Cellar v1.1.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 23:10

What is new, in short:

  • One memory budget for everything. Cellar can now count every byte a program holds - its cache, a WebAssembly memory, compiled code - in one place, and free old cached data first when something new does not fit.
  • Two-way calls. A link lets two threads call each other; a thread waiting for its answer still answers the other side meanwhile, so the two never lock each other up.
  • Tables. Counters and small records that one thread writes and any thread reads at any time, without asking the writer. Also a list of handles any thread can take and give back.
  • The cache from any thread. The thread that owns the cache can be asked from another thread, over a channel or a link.
  • Less waiting, less waking. Each side of a link sleeps on one word, and a full ring wakes its writer only when the writer is actually waiting for room. A call that could not be sent in its time limit is not sent late.
  • Nothing left stuck. Space nobody needs any more - a write a thread abandoned, an old record its last reader has left - is reclaimed the next time the cache needs room.

If you used 1.0.0: a few calls changed (listed below), and all threads of one program must use the same version, because the shared memory layout changed. Data already saved to disk still opens.

Changed from 1.0.0:

  • INDEX_FILES, packFile and readSaved moved to the new entry @bottlify/cellar/advanced, together with the other low-level helpers.
  • Write options are now one number made by reserveFlags({ onlyCopy, disk, idle }): pass it to reader.reserve(name, length, flags) and reader.put(name, bytes, flags) instead of an options object.
  • keeper.reserve (and KeeperCalls.reserve) is (name, length, flags, known, place, writer?): it fills the place array you pass and returns true, or returns false, instead of creating an object.
  • createRingMemory(capacity, bell, roomBell) takes a second doorbell, rung when room frees up while the writer waits for it.
  • Too many queued calls: both a link side and a channel client limit them with unsentLimit, and refuse the extra call as not sent.
  • A time limit now also covers waiting to send: a call that could not get room in time fails with ChannelNotSent or LinkNotSent; a limit of 0 sends only if there is room right now.
  • A link side closes in one way only, whoever starts it, and only one serve may run on a side.
  • account.fits(bytes, kind?, given?) can count memory about to be given back.
  • The shared memory layouts of the cache, rings and tables changed; memory from another version is refused when opened.

Added:

  • Memory budget: createAccountMemory, openAccount, openCharge, memoryBytes, ACCOUNT_UNIT, RUN_HOLDER.
  • Links: createLinkMemory, openLink, LinkClosed, LinkNotSent, LinkNotAnswered.
  • Tables: createTableMemory, openTable.
  • The cache from another thread: openKeeperClient, serveKeeperChannel, answerKeeper, keeperWords, linkCarrier.
  • Clearer channel errors: ChannelNotSent (the call never left) and ChannelNotAnswered (it left, no answer in time).
  • Helpers: reserveFlags, mayWait (may this thread block?), grainsOf.
  • Documentation for each part, including how long data lives, who may write where, and what time limits cover; and a page on how all this is tested.

Cellar v1.0.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 21:08

The first version on npm. Cellar lets JavaScript threads share memory directly: call each other, pass streams of data and wait for each other, without sending messages through postMessage. A small call between two threads takes about 2 µs instead of about 38 µs (Benchmarks); made for the browser, also runs on Node.js 22 and later, no dependencies.

What it contains, one entry, @bottlify/cellar: the cache (openKeeper, createReader, INDEX_FILES, packFile, readSaved), channels (createChannel, openClient, openServer, ChannelClosed, ChannelFailed), doorbells (createDoorbell, openDoorbell, publish, ring, wake, waitFor, waitForAsync, createSpin, deadlineOf, SPIN_MS), rings (createRingMemory, openRing, RingClosed) and journals (createJournalMemory, openJournal).

Cellar v0.14.2

Choose a tag to compare

@github-actions github-actions released this 26 Nov 20:42

Built from 9c9ada4.

Cellar v0.14.1

Choose a tag to compare

@github-actions github-actions released this 26 Nov 20:30

Built from 526e639.

Cellar v0.14.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 19:19

Built from da6b727.

Cellar v0.13.2

Choose a tag to compare

@github-actions github-actions released this 26 Nov 16:21

Built from 7a50c5d.

Cellar v0.13.1

Choose a tag to compare

@github-actions github-actions released this 26 Nov 16:02

Built from 5adf635.

Cellar v0.13.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 12:14

Built from ba19662.