dax· @thdxr · X·· 6 天前AI 评分29
AI 导读
jlongster 表示借助 Carbon 模型在一天内将解释器重构为字节码虚拟机以实现暂停与恢复功能,dax 转发并肯定了 Carbon 的实际应用效果。dax 进一步解析指出,传统持久化工作流通常需保存每次调用结果并在恢复时完整重放流程,而 psychoscript 采用字节码虚拟机架构,可直接对内存状态创建快照并恢复,无需重放所有步骤。
正文 · 原文
see we use carbon for real things!
but also what's fun about this is this is an old problem you've seen in durable workflow products
the simple way to deal with it is to save results from function calls, replay everything and skip cached results
but that means if you had
total = 0
for (1...10_000)
total = step(() => myFunction(i))
it would have to save the result from every single call to be resumable
psychoscript has a bytecode vm so it can just snapshot its in memory state and resume without having to replay everything
craziest thing about this we needed the suspend/resume feature, so we rewrote it from an interpreter to a bytecode virtual machine I was able to do this in the background in a day while doing other work I used the Carbon model, it's good https://t.co/oYGFA7zbLI在 X 查看被引用的帖子
来源:dax · x.com