-
Notifications
You must be signed in to change notification settings - Fork 243
Description
During evaluation of #198 the issue of big endian code not being tested by the CI pipelines was raised.
This means, despite code being in place to support it, the architectures should be considered unsupported because they're untested.
There are a few options to deal with this:
- Properly considering those archs unsupported, in which case the reasonable way to deal with it is to remove the code and just assume little endian;
- Add pipelines to run on at least one such architecture.
The Go toolchain supports a few BE archs, in particular PowerPC64 with GOARCH=ppc64, and qemu can be used to run commands on the emulated architecture, and I successfully cross-compiled and run the tests for ppc64 that way locally:
$ GOARCH=ppc64 go test -c -o ppc64_test
$ qemu-ppc64 ./ppc64_test
==roaring==
{1,2,3,4,5,100,1000}
{3,4,1000}
{}
Cardinality: 7
Contains 3? true
1
3
4
5
1000
Wrote 22 bytes
I wrote the content to a byte stream and read it back.
size before run optimize: 1810 bytes, and after: 38 bytes.
2022/01/13 19:39:53 rtest N= 15
2022/01/13 19:39:53 rtest N= 1024
2022/01/13 19:39:54 rtest N= 4096
2022/01/13 19:39:54 rtest N= 65536
2022/01/13 19:39:55 rtest N= 1048576
2022/01/13 19:40:04 rtest N= 15
2022/01/13 19:40:04 rtest N= 100
2022/01/13 19:40:04 rtest N= 512
2022/01/13 19:40:04 rtest N= 1023
2022/01/13 19:40:04 rtest N= 1025
2022/01/13 19:40:04 rtest N= 4095
2022/01/13 19:40:04 rtest N= 4096
2022/01/13 19:40:04 rtest N= 4097
2022/01/13 19:40:04 rtest N= 65536
2022/01/13 19:40:05 rtest N= 1048576
2022/01/13 19:41:26 rtest N= 15
2022/01/13 19:41:26 rtest N= 1024
2022/01/13 19:41:26 rtest N= 4096
2022/01/13 19:41:26 rtest N= 65536
2022/01/13 19:41:26 rtest N= 1048576
2022/01/13 19:41:35 rtest N= 15
2022/01/13 19:41:35 rtest N= 100
2022/01/13 19:41:35 rtest N= 512
2022/01/13 19:41:35 rtest N= 1023
2022/01/13 19:41:35 rtest N= 1025
2022/01/13 19:41:35 rtest N= 4095
2022/01/13 19:41:35 rtest N= 4096
2022/01/13 19:41:35 rtest N= 4097
2022/01/13 19:41:35 rtest N= 65536
2022/01/13 19:41:36 rtest N= 1048576
200100
PASSIn case we choose to support those by adding pipelines to check them, we should decide whether we want to make them first or second class citizens with regards to performance. Most mainstream architectures being little endian, it may make sense to trade off performance in BE if this improves performance for the LE case.
This question is practical rather than hypothetical, as it was suggested for hashing to cast slices in a way that would mean extra allocations for BE, in exchange for the ability to pass bigger blocks to the hasher.
For a start, it would be interesting to know whether there are currently any users of BE roaring.