Comments (6)
Thanks.
I don't think that it is comparable, at all. The simdcomp library is a low level library that supports some algorithms, but it does not provide an integrated data structure. It is up to you to build up a format, data structure.
Roaring bitmaps are a standard format, a set of data structures and so forth.
If you are interested in something like variable-length coding, I suggest you look up the streamvbyte library instead.
from simdcomp.
Thanks for the quick reply, one more doubt.
As per the https://github.com/powturbo/TurboPFor#StreamVByte, streamvbyte isn't looking at the best position. Is it too old or streamvbyte changed after that?
I was checking simdcomp as it was doing very well against all others,
And would be eyeing to use the simdcomp for random sized array compressions from golang.
(sorry, as there are many materials out there, i may not be looking in the right order too)
from simdcomp.
You have looked at
https://github.com/lemire/simdcomp/blob/master/go/test.go
No doubt?
I am not sure I know what you mean by "a sample".
streamvbyte isn't looking at the best position. Is it too old or streamvbyte changed after that?
Please refer to https://github.com/lemire/streamvbyte and the paper at https://arxiv.org/abs/1709.08990
Stream VByte is extremely fast. I don't think that there is any byte-oriented codec out there that can match it.
from simdcomp.
Thats cool,
I wasn't clear enough(wrongly used the words) on my ask for that go/test.go extension.
Currently it depicts the use of a 128 length block. And my request was for a cgo example for any random length like here -https://github.com/lemire/simdcomp/blob/master/example.c#L13
from simdcomp.
I was playing with a few benchmark tests like below. (exploring cgo, so might be not the right way/ some mistakes there)
Both simdcomp and streamvbyte over cgo.
go test -benchmem -bench=.
goos: darwin
goarch: amd64
BenchmarkTestSIMDEncode-8 20000000 73.9 ns/op 0 B/op 0 allocs/op
BenchmarkTestSIMDDecode-8 20000000 74.7 ns/op 0 B/op 0 allocs/op
BenchmarkTestSvbEncode-8 10000000 123 ns/op 0 B/op 0 allocs/op
BenchmarkTestSvbDecode-8 20000000 96.5 ns/op 0 B/op 0 allocs/op
code
func BenchmarkTestSIMDEncode(t *testing.B) {
CallSIMDEncode(t.N)
}
func BenchmarkTestSIMDDecode(t *testing.B) {
CallSIMDDecode(t.N)
}
func BenchmarkTestSvbEncode(t *testing.B) {
CallSvbEncode(t.N)
}
func BenchmarkTestSvbDecode(t *testing.B) {
CallSvbDecode(t.N)
}
package svb
/*
#cgo LDFLAGS: -lsimdcomp
#include <simdcomp.h>
*/
import "C"
func CallSIMDEncode(n int) {
var data [128]C.uint32_t
for i := C.uint32_t(0); i < C.uint32_t(128); i++ {
data[i] = C.uint32_t(i*1000 + i*100 + i)
}
b := C.maxbits(&data[0])
out := make([]C.__m128i, b)
for i := 0; i < n; i++ {
C.simdpackwithoutmask(&data[0], &out[0], b)
}
}
func CallSIMDDecode(n int) {
var data [128]C.uint32_t
for i := C.uint32_t(0); i < C.uint32_t(128); i++ {
data[i] = C.uint32_t(i*1000 + i*100 + i)
}
b := C.maxbits(&data[0])
out := make([]C.__m128i, b)
C.simdpackwithoutmask(&data[0], &out[0], b)
var recovereddata [128]C.uint32_t
for i := 0; i < n; i++ {
C.simdunpack(&out[0], &recovereddata[0], b)
}
}
package svb
/*
#cgo LDFLAGS: -lstreamvbyte
#include <streamvbyte.h>
#include <stdlib.h>
*/
import "C"
import (
"unsafe"
)
func CallSvbEncode(n int) {
const count = C.uint32_t(128)
var data [count]C.uint32_t
for i := C.uint32_t(0); i < C.uint32_t(count); i++ {
data[i] = C.uint32_t(i*1000 + i*100 + i)
}
size := C.size_t((count+3)/4 + (count * 4))
compressedbuffer := C.malloc(size * C.size_t(unsafe.Sizeof(C.uint8_t(0))))
for i := 0; i < n; i++ {
_ = C.streamvbyte_encode(&data[0], count, (*C.uint8_t)(compressedbuffer))
}
C.free(unsafe.Pointer(compressedbuffer))
}
func CallSvbDecode(n int) {
const count = C.uint32_t(128)
var data [count]C.uint32_t
for i := C.uint32_t(0); i < C.uint32_t(count); i++ {
data[i] = C.uint32_t(i*1000 + i*100 + i)
}
size := C.size_t((count+3)/4 + (count * 4))
compressedbuffer := C.malloc(C.size_t(size) * C.size_t(unsafe.Sizeof(uintptr(0))))
_ = C.streamvbyte_encode(&data[0], count, (*C.uint8_t)(compressedbuffer))
decodedbuffer := make([]C.uint32_t, count)
for i := 0; i < n; i++ {
_ = C.streamvbyte_decode((*C.uint8_t)(compressedbuffer), &decodedbuffer[0], count)
}
C.free(unsafe.Pointer(compressedbuffer))
}
from simdcomp.
Pull requests are invited!!!
It is a great idea to provide more examples, but I simply can't do it all... I rely on people like you to help out.
from simdcomp.
Related Issues (20)
- SSE2 compatibility should be warranted HOT 21
- simdunpack doesn't decompress the values properly HOT 12
- Javascript version HOT 31
- Which code to use? HOT 3
- How to compress/decompress sorted array of arbitrary length? HOT 6
- Get maxbits for compressed array HOT 2
- How to get the usable bytes from a compressed array? HOT 11
- /GS for release Windows builds HOT 16
- Add to Microsoft's VC++ Packaging Tool
- heap-buffer-overflow (detected by LibFuzzer) HOT 3
- Add ARM64 / Aarch64 support HOT 3
- Packing 2 bits values into a bigger HOT 5
- Use this to compress file? HOT 1
- Could you explain please why using ternary operator instead of bitwise or? HOT 1
- Is it possible to speedup 128 block decoding via 256 bit instructions?
- Comment on performance for uint64_t performance
- how can I compress any size of sorted uint32 array HOT 1
- Unable to compress array of random numbers HOT 1
- Support signed differential coding HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simdcomp.