Re: fast serialization of huge bit vectors?
Jens Thiele <[email protected]> Thu, 07 May 2026 16:59:48 +0200
| Newsgroups | gmane.lisp.scheme.gauche |
|---|---|
| Message-ID | <[email protected]> |
Shiro Kawai <[email protected]> writes: > bitvector->uvector/shared and uvector->bitvector/shared are added. > https://github.com/shirok/Gauche/commit/57303f6feadfdb592e1c4e0f25f76b7c47edb8c4 nice, thanks! jens PS: testing in amd64 debian sid chroot: - looks like gauche 0.9.15 isn't good enough to build current git => first built bleeding using get-gauche.sh then built git $ git describe v0.9.13-1919-g46bb5b921 $ make check Total: 37919 tests, 37919 passed, 0 failed, 0 aborted. (sid-amd64-sbuild)karme@amalthea:/tmp/Gauche$ src/gosh -ftest gosh$ (use gauche.uvector) gosh$ (use gauche.bitvector) gosh$ ;; for comparision test with u8vector gosh$ (define v (make-u8vector (ash 1 (- 29 3)) 0)) v gosh$ (time (with-output-to-file "/tmp/v" (cut write-uvector v))) ;(time (with-output-to-file "/tmp/v" (cut write-uvector v))) ; real 0.513 ; user 0.310 ; sys 0.150 #<undef> gosh$ (define bv (make-bitvector (ash 1 29))) bv gosh$ (bitvector-length bv) 536870912 gosh$ (bitvector->uvector/shared bv) #u8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...) gosh$ (time (with-output-to-file "/tmp/v" (cut write-uvector (bitvector->uvector/shared bv)))) ;(time (with-output-to-file "/tmp/v" (cut write-uvector (bitvector->uvec ... ; real 0.513 ; user 0.300 ; sys 0.160 #<undef> gosh$ (time (with-input-from-file "/tmp/v" (lambda() (bitvector-length (uvector->bitvector/shared (port->uvector (current-input-port))))))) ;(time (with-input-from-file "/tmp/v" (lambda () (bitvector-length (uvec ... ; real 0.426 ; user 0.420 ; sys 0.020 536870912