优化提议:pb.decode 传入的二进制data支持起始索引和数量
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at the pb.decode entry point and trace how the input data length is currently consumed. Add optional start and count arguments while preserving existing calls without them. Done means embedded protobuf data can be decoded directly from the original string, with only the selected byte range parsed.
Written by the indexing model from the issue text.
Description
我用skynet的bson模块,编码时需要在string前面加到2个字节的类型信息,才能识别出这是一个二进制的BSON类型。
解码bson时,发现是二进制同样会先加2个字节再加二进制数据,最后返回一个string。
这个二进制实际上是一个pb数据,按现在的接口我只能先 string.sub 去掉前面字节,再传入pb.decode,会多一次字节串的创建和拷贝。
期望能在pb.decode引入2个可选参数: pb.decode(type, data, table, start, count),start表明从data的第几个字节开始解析,count指定解析多少个字节。
这样拿到的二进制就直接可以丢给pb.decode了。
- Dominant language
- Lua
- Stars
- 1.9k
- Forks
- 400
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from starwing/lua-protobuf
-
question
Difficulty 3/5 1-2 days Newbie friendliness 35/100
starwing/lua-protobuf#282 · 4 comments ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 15/100
starwing/lua-protobuf#279 · 2 comments ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 30/100
starwing/lua-protobuf#278 · 2 comments ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 30/100
starwing/lua-protobuf#273 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
starwing/lua-protobuf#271 · 14 comments ·
All issues in starwing/lua-protobuf
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
[Eco] Egg Config Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
pterodactyl/game-eggs#634 ·
-
Feature Request
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Questie/QuestieTrace#33 ·