ZheNing Hu <adlternative@xxxxxxxxx> writes: > This means that I shouldn't touch the content of struct commit. So I see the > code of `commit-slab`, it seems that it is doing additional parsing. We should keep what is in "struct commit" and parsing overhead to the minimum, as it matters to performance (especially when auxiliary data structures like commit-graph are not available for the part of history). If some pieces of data (like "from this byte to the end is %(body)") do not matter in commit traversal, they are optional, and (1) we should not always parse them out, instead we should do so only on demand, and (2) we should not add members for them in the commit object, but use commit slabs to store them. As to the slab, it is not like you have to have a slab per these optional fields you may want to parse. If for example you need the authorship ident and timestamp, even if you do not need committer ident and timestamp, it is plausible to have a type of slab that holds these four data items together (and only fill parts of them that are actually requested by the callers). Also, things that are strings may want to be stored as a relative offset into the commit buffer, instead of duplicated copies of string values.