-
Notifications
You must be signed in to change notification settings - Fork 14
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
crc32 speed boost #99
Comments
The code to test conflux writer speed: window.testWriterSpeed=function(){
let memFile=new File([new ArrayBuffer(1*1024**3)],'1GB.bin', {type:'application/octet-stream'});
console.time('zip');
let iterator=[memFile].values();
let entryStream=new ReadableStream({
async pull(controller) {
const {done, value:entry} = iterator.next();
if (done)
return controller.close();
return controller.enqueue(entry);
},
});
let nullStream=new WritableStream({
async write(chunk) {},
close() {}
});
entryStream.pipeThrough(new Writer()).pipeTo(nullStream).finally(()=>{
console.timeEnd('zip');
});
}; and here is my Crc32 implementation based on hash-wasm: import 'hash-wasm/dist/crc32.umd.min.js'; /* global hashwasm */
class Crc32 {
constructor() {
}
async init(){
let crc32=await hashwasm.createCRC32();
crc32.init();
this.crc32 = crc32;
}
append(data) {
this.crc32.update(data);
}
get() {
return new DataView(this.crc32.digest('binary').buffer).getUint32(0);
}
}
export default Crc32; Note: this Crc32 implementation defined a method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to speed up conflux by replacing crc32 implementation with thirdparty high performance crc32 lib (which uses asm.js/wasm/simd), and I did some tests:
Note: tested with 1GB in-memory file, 2MB chunk size.
So my proposal is to adjust conflux to allow developers use/configure custom crc32 implementaion.
The text was updated successfully, but these errors were encountered: