protocolbuffers / protocolbuffers/protobuf-javascript
Javascript code is extraordinarily slow
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 471
- フォーク
- 91
- 平均マージ
- 3時間 57分
- マージ済み PR(30日)
- 2
説明
Version: 3.9.1
Language: Javascript
I have a message like this:
message Outer {
repeated Inner inner = 1;
}
message Inner {
repeated Item items = 1;
}
message Item {
uint32 a = 1;
uint32 b = 2;
uint32 c = 3;
uint32 d = 4;
uint32 e = 5;
}
It contains approximately 1000 Inners and 700k Items in total and comes out at about 10MB. Using the default Javascript implementation of protobufs it takes 10 seconds to decode. I switched to using Mapbox pbf, and that only takes 170 milliseconds.
I looked at PBF's code and they don't seem to be doing anything special. decodeVarint looks like it has had some work to make Javascript engines happy with varints normally being less than 2^32, but... come on! That's 2 orders of magnitude! How is this implementation so slow?
Another issue is that this code generates objects with getters and setters, rather than just creating a plain object. Why? It just means I have to do even more tedious work when my message has been decoded to turn it into a form that I can easily use!
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告されたネストされたスキーマと約10MBのデータセットに対してデフォルトのJavaScript protobufデコーダーをプロファイリングし、次にそのvarintデコードとオブジェクト構築をMapbox PBFと比較します。パフォーマンスの差とgetter/setterの挙動が対応可能な変更に当たるかを判断します。完了の条件は、改善を示す測定結果とテストを伴う、範囲を限定したfixです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100