-
Notifications
You must be signed in to change notification settings - Fork 0
hash::aggregate が全ファイル内容をメモリに溜めてからハッシュ計算している #86
Copy link
Copy link
Open
Labels
Kind/EnhancementImprove existing functionalityImprove existing functionalityModule: LibraryThe library registration domainThe library registration domainPerformanceRelated to runtime or registration speedRelated to runtime or registration speedPriority/LowThe priority is lowThe priority is low
Description
Activity
Metadata
Metadata
Assignees
Labels
Kind/EnhancementImprove existing functionalityImprove existing functionalityModule: LibraryThe library registration domainThe library registration domainPerformanceRelated to runtime or registration speedRelated to runtime or registration speedPriority/LowThe priority is lowThe priority is low
症状
library/hash.rsのaggregateは、全ファイルのパスと内容をVecに集めてから相対パスでソートし、その後にハッシュ計算のループを回す。巨大なライブラリ (数百 MB 級のヘッダー群や、誤って登録した大きなツリー) のadd/update/バンドルごとのverifyで、ライブラリ総量ぶんのメモリを一時的に確保する。対処案
相対パスの決定的な順序が必要なのは事実だが、内容自体は逐次ハッシュに流し込める。先に (相対パス, ファイルサイズ) 等の軽量情報だけを集めてソートし、順にファイルを開いて
hasher.updateへストリームすれば、ピークメモリをファイル1個分に抑えられる。🤖 Generated with Claude Code