protocolbuffers / protocolbuffers/protobuf-javascript

Using JS typed arrays in JoinFloat

オープン
#87 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement javascript P3 triaged
主要言語
JavaScript
スター
471
フォーク
91
平均マージ
3時間 57分
マージ済み PR(30日)
2

説明

Hi,

Has anyone thought of using JS typed arrays in the splitFloat and joinFloat methods for the JavaScript library (https://github.com/google/protobuf/blob/master/js/binary/utils.js#L388)?

One could imagine adding something like:

jspb.utils.joinFloat64 = function(bitsLow, bitsHigh) {
    if (window.Uint32Array) {
        bytes = Uint8Array.of(bitsLow, bitsHigh)
        data = new Float64Array(bytes.buffer)
        return data[0];
    }
    // ...
}

And vica-versa for the splitFloat method. This might increase readability (and depending on if it taps into the JS engine's native implementation, maybe even speed).

Happy to write the PR, just curious if it would be useful / appreciated!

Let me know,

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

js/binary/utils.js の 388 行目付近から始め、splitFloat と joinFloat の実装、およびその周辺の互換性ロジックを読みます。既存のフォールバック動作を失わずに、そこで typed arrays を使用できるか評価してください。両方のメソッドがサポート対象のすべての環境で引き続き正しく動作し、変更がレビュー可能な状態になれば作業完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
backend
issue の種類
リファクタリング
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。