Mercurial > gemma
diff pkg/octree/strtree.go @ 4650:f5fce22184da stree-experiment
Added a deserializer from STRTrees.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 14 Oct 2019 01:28:18 +0200 |
parents | 18331577a251 |
children | f5492fda097c |
line wrap: on
line diff
--- a/pkg/octree/strtree.go Sun Oct 13 22:15:55 2019 +0200 +++ b/pkg/octree/strtree.go Mon Oct 14 01:28:18 2019 +0200 @@ -165,16 +165,12 @@ return err } - if err := binary.Write(w, binary.LittleEndian, s.index[0]); err != nil { - return err - } - var buf [binary.MaxVarintLen32]byte var last int32 var written int - for _, x := range s.index[1:] { + for _, x := range s.index { delta := x - last n := binary.PutVarint(buf[:], int64(delta)) for p := buf[:n]; len(p) > 0; p = p[n:] { @@ -184,9 +180,9 @@ } written += n } - last = x } + log.Printf("info: compressed index in bytes: %d %.2f (%d %.2f)\n", written, float64(written)/(1024*1024),