• Robert Griesemer's avatar
    suffixarray: improved serialization code · 5ee7ef90
    Robert Griesemer authored
    Use gobs to serialize indexes instead of encoding/binary.
    
    Even with gobs, serialize data in slices instead of
    applying gob to the entire data structure at once,
    to reduce the amount of extra buffer memory needed
    inside gob.
    
    7x faster Write/Read for new BenchmarkSaveRestore
    compared to old code; possibly because encoding/binary
    is more expensive for int32 slice elements (interface
    call to get little/big endian encoding), while gob's
    encoding is fixed (unconfirmed).
    
    new (using gobs):
    suffixarray.BenchmarkSaveRestore	       1	2153604000 ns/op
    
    old (using encoding/binary):
    suffixarray.BenchmarkSaveRestore	       1	15118322000 ns/op
    
    The actual serialized data is slightly larger then using
    the old code for very large indices because full 32bit indices
    require 5bytes using gobs instead of 4bytes (encoding/binary)
    in serialized form.
    
    R=r
    CC=golang-dev
    https://golang.org/cl/5087041
    5ee7ef90
Name
Last commit
Last update
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...