Merge pull request #78 from cmasone-attic/reminders

Add a few reminder comments about hot-paths
This commit is contained in:
cmasone-attic
2015-07-20 10:56:01 -07:00
2 changed files with 2 additions and 2 deletions

View File

@@ -129,7 +129,7 @@ func (w *fileChunkWriter) Close() error {
totalBytes := w.buffer.Len()
written, err := file.Write(w.buffer.Bytes())
Chk.NoError(err)
Chk.Equal(totalBytes, written, "Too few bytes written.")
Chk.True(totalBytes == written, "Too few bytes written.") // Hot path!
w.buffer = nil
return nil

View File

@@ -75,7 +75,7 @@ func MustParse(s string) Ref {
// Particularly, Chk.Equals{Value} does reflection, and this can be expensive, so avoid it here.
func Less(r1, r2 Ref) bool {
d1, d2 := r1.digest, r2.digest
Chk.True(len(d1) == len(d2))
Chk.True(len(d1) == len(d2)) // Hot path!
for k := 0; k < len(d1); k++ {
b1, b2 := d1[k], d2[k]
if b1 < b2 {