libgit2 / libgit2/libgit2

Perf suggestion for crlf handling

オープン
#3,212 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

主要言語
C
スター
10.6k
フォーク
2.7k
PR マージ指標
30日以内にマージされた PR はありません

説明

I haven't measured this but....

As long a the crlf filtering is loading the entire blob/file into a buffer, there are some opportunities here for perf gains.

In git_buf_text_is_binary() we examine the entire file. While there we could count the number of CRLFs, and plain LFs and return those sums. We should be able to use those sums in git_buf_text_gather_stats(). Or combine those 2 routines into 1. Then in git_buf_text_lf_to_crlf() add this delta "(count_crlf - count_lf)" as padding to the amount of reserved space in the destination buffer so that the memcpy loop doesn't need to realloc as the file is being converted.

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

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

はじめの一歩

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

調査の方向性

まず git_buf_text_is_binary()、git_buf_text_gather_stats()、git_buf_text_lf_to_crlf() を読んで、現在のバッファと行末の処理を理解してください。提案されている結合カウントとパディングを評価する前に、既存の動作を測定してください。変換によって不要な再割り当てを避けつつ、結果のテキストを変更しなければ完了です。

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

評価

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

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

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