How to efficiently track and store deltas between two HAMTs
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
未指定文件或测试。首先审查 HAMT 和 Map 的 update/delete 实现,然后确定 delta 表示是否能够在不需要提议的 scan 的情况下保留结构共享。完成标准是:一种高效且有文档说明的方法,或一次范围明确的 API 变更,并为该示例提供覆盖。
由索引模型根据 Issue 内容生成。
描述
Ideally, I would like to be able to do
x = Map({'a': 2, 'c': 1})
y = x.update({'b': 3: 'c': 2)
z = y - x # magic
z == Map({'b': 3, 'c': 2})
Is there any particularly efficient way to do this in terms of memory and computational time? Ideally, I'd like z to share its data with y in the same way y shares its data with x. One way that comes to mind is
def diff(y, x):
z = y
for k, v in y.items():
if k in x and x[k] == v:
z = z.delete('k')
return z
But this is O(N log N) (for log N get/set). Is there a more efficient way to go about this?
- 主要语言
- C
- 星标
- 1.2k
- 派生
- 60
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/immutables 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 38/100
MagicStack/immutables#121 · 6 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
MagicStack/immutables#107 ·
-
难度 3/5 1-2 天 新手友好度 32/100
MagicStack/immutables#102 ·
-
难度 5/5 一周以上 新手友好度 20/100
MagicStack/immutables#82 ·
-
难度 5/5 一周以上 新手友好度 30/100
MagicStack/immutables#55 · 3 条评论 ·
查看 MagicStack/immutables 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
BasedHardware/omi#15662 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
-
level/task module/gcp type/bug
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
难度 1/5 1 小时以内 新手友好度 85/100