nv-bit-1-on-32
v1.0.1
Published
nv-bit-1-on-32 ======================= - a simple bit-array FOR big-size (> 256M) - pure js - IF size <=512M USE using\_smia.creat FOR speed - IF size >=512M AND <= 3G~4G
Downloads
1
Readme
nv-bit-1-on-32
a simple bit-array FOR big-size (> 256M)
pure js
IF size <=512M USE using_smia.creat FOR speed
IF size >=512M AND <= 3G~4G USE using_i32a.creat
IF size >=4G , it CANT work, it maybe crash (based on your v8 AND runtime start-up config)
its used for test pure-js bloom-filter , normally USELESS
its faster than nv-bit-1(which is generated by script). this is wrote by human.
install
- npm install nv-bit-1-on-32
splitted
usage
const { using_smia,using_i32a} = require("nv-bit-1-on-32");
example
small
// <=512M
const {sync} = require("nv-facutil-simple-test")
var creat = using_smia.creat;
var sz = 2**29;
var b1 = creat(sz);
//%DebugPrint(b1) packed_smi
var f =(cnt) => {
for(let i=0;i<cnt;++i) {b1.set(i,i%2)}
for(let i=0;i<cnt;++i) {if(b1.get(i) !== (i%2)) {throw(i)}}
}
var res = sync(1,f,2**29)
console.log(res)
/*
{ rounds: 1, f: [Function: f], costed: 2734.416069984436 }
*/
//%DebugPrint(b1) packed_smi
big
> 512M
var creat = using_i32a.creat;
var ab = new ArrayBuffer(2**31)
var si = 0;
var sz = 2**31;
var b1 = creat(ab,si,sz);
var f =(cnt) => {
for(let i=0;i<cnt;++i) {b1.set(i,i%2)}
for(let i=0;i<cnt;++i) {if(b1.get(i) !== (i%2)) {throw(i)}}
}
console.log(sync(1,f,2**31))
/*
{ rounds: 1, f: [Function: f], costed: 47496.44641697407 }
*/
METHODS
APIS
using\_smia.creat(size): Array
using\_i32a.creat(ab:ArrayBuffer, si=0, size): Int32Array
LICENSE
- ISC