achingbrain / achingbrain/uint8arraylist

Optimize for common usage with libp2p

未关闭
#59 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
11
派生
9
PR 合并指标
30 天内没有已合并 PR

描述

In many cases for the libp2p packages this lib is only used for the cases when N = 1, and the flow is usually "append" -> "sublist" -> "consume". Usually, also, the array only contains 1 element.

So

1). Append
Initialize the empty array in the constructur, and append 1 element to it

2). Sublist
Aquire a sublist which is in many cases just a shallow copy of this array

3). Consume
Make the array empty again

---
If this lib instead of utilize an ```linked list``` instead, we could in theory get overall better performance.

1). Append
On appending the first element, the head is set to the first element

2).
A shallow copy

3).
set the head and tail to be undefined

We could do even better, if we combine 2 and 3 into one method called "splice", we can cut the linked list at an appropriate place, which means that we will do much less operations.

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先跟踪库中的 append、sublist 和 consume 入口,并记录当前基于数组的流程在 N = 1 时的行为。将该行为与提议的链表和 splice 方案进行比较;当常见的 append–sublist–consume 流程在性能得到提升的同时保持其语义时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
performance
Issue 类型
重构
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。