-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
full memory mode support #2
Comments
This is currently not planned, because I am designing the library to be the most performant given the restrictions of the average browser. Eventually yes, this could become a possibility. If enough people get behind a full speed RandomX implementation, completely implemented using web standards only (no FFI) I will budge. |
It is true that browsers won't let you allocate a 2 GB buffer, however you can allocate two 1GB buffers. const GB = 1024 * 1024 * 1024;
class Buff2GB {
arr1;
arr2;
constructor() {
this.arr1 = new Uint8Array(GB);
this.arr2 = new Uint8Array(GB);
}
read(idx) {
return idx < GB ? this.arr1[idx] : this.arr2[idx - GB];
}
set(idx, val) {
if (idx < GB) {
this.arr1[idx] = val;
} else {
this.arr2[idx - GB] = val;
}
}
}
var mem = new Buff2GB();
for (let i = 0; i < 100000000; i++) {
const idx = (Math.random() * GB * 2) | 0;
const val = (Math.random() * 255) | 0;
mem.set(idx, val);
}
console.log("DONE"); Also I should note thate Node JS does allow you to allocate a 2 GB buffer. |
it would be nice to support RandomX full mode, mainly for testing, but it can be useful for faster hashing in Node.JS when a lot of memory is available.
The text was updated successfully, but these errors were encountered: