Improve actor startup time and memory usage #26

Open
opened 2025-06-04 02:37:47 +00:00 by john · 1 comment
Owner

Per actor memory usage ~ 267kb to start with debug stripped; I'm not sure how much this can be brought down, but doing less in the startup scripts should help. A test quickjs with all intrinsics enabled comes in to around 60kb, so we're adding around 207kb; probably too much.

Startup time is about 2.3ms. Ideally this would be sub 1 ms, or even faster.

Per actor memory usage ~ 267kb to start with debug stripped; I'm not sure how much this can be brought down, but doing less in the startup scripts should help. A test quickjs with all intrinsics enabled comes in to around 60kb, so we're adding around 207kb; probably too much. Startup time is about 2.3ms. Ideally this would be sub 1 ms, or even faster.
Author
Owner

What needs to happen here for lower memory:

docs need to come off of being on objects. Documentation must be a sidecar; it's not good to have each actor holding it, and makes no sense. One doc set per system.

much less needs to happen in base.cm. We monkey patch a lot; they should instead be modules you can pull in, so actors can only get what they need. The thinnest actors can be 50kb, perhaps.

We can even go in and carve out functions in quickjs. For example, remove some of the math functions; these should be in the misty style anyway.

And then finally, move some of our own functions into C, so they're a mere function pointer. This will probably be the biggest win.

Ultimately, 1 C function is about 100 bytes in JS

What needs to happen here for lower memory: docs need to come off of being on objects. Documentation must be a sidecar; it's not good to have each actor holding it, and makes no sense. One doc set per system. much less needs to happen in base.cm. We monkey patch a lot; they should instead be modules you can pull in, so actors can only get what they need. The thinnest actors can be 50kb, perhaps. We can even go in and carve out functions in quickjs. For example, remove some of the math functions; these should be in the misty style anyway. And then finally, move some of our own functions into C, so they're a mere function pointer. This will probably be the biggest win. Ultimately, 1 C function is about 100 bytes in JS
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: john/cell#26
No description provided.