You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for better performance, it may be desirable to port this library to WebAssembly.
It is a bit early to try to port the whole thing, but two crucial functions can already be ported easily : 'sign' and 'grade'. It is my understanding that those two functions are a performance bottleneck, so they may be worth implementing right now.
The following C code can be compiled for instance with the WASM explorer:
typedef unsigned long int integer;
int grade(integer b);
int sign(integer a, integer b) {
integer n = a >> 1;
int sum = 0;
while (n != 0) {
sum += grade(n & b);
n >>= 1;
}
return sum&1 ? -1 : 1;
}
int grade(integer b) {
unsigned int n = 0;
while (b != 0) {
if (b&1) { n++; }
b >>= 1;
}
return n;
}
That would limit the number of vector dimensions to 32 (or 64 if we really want that), but who needs more than 32 vector dimensions anyway?
The text was updated successfully, but these errors were encountered:
Hello,
for better performance, it may be desirable to port this library to WebAssembly.
It is a bit early to try to port the whole thing, but two crucial functions can already be ported easily : 'sign' and 'grade'. It is my understanding that those two functions are a performance bottleneck, so they may be worth implementing right now.
The following C code can be compiled for instance with the WASM explorer:
That would limit the number of vector dimensions to 32 (or 64 if we really want that), but who needs more than 32 vector dimensions anyway?
The text was updated successfully, but these errors were encountered: