sbt / util

util modules for sbt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FileInfo hashes use List[Byte]

jroper opened this issue · comments

FileInfo hashes are using List[Byte] to store sha1 hashes. When using Array[Byte], a sha1 hash takes up approx 40 bytes of contiguous memory (including object headers etc). By contrast, a List[Byte] is stored as a collection of :: nodes (but not java.lang.Byte instances because these are cached) and can take up to 32 bytes of memory per byte. In total, a sha1 hash stored as a List[Byte] can take up to 640 bytes of memory, across 20 non cached objects, requiring 41 object dereferences to iterate over. I don't know how big an impact this would actually have on performance, but it seems like such a needless waste - especially considering the classes are private and hence immutability would effectively be guaranteed when using Array[Byte].