3 ms·
console.log(bulk.length); console.log(new Date()); pos= bulk.indexOf("788bbd6b12d79a4ee18e36a8a264fb496465c71b7932a965ed731397b7c97d14"); console.log(pos); cons
by tbrownaw 9y ago
console.log(bulk.length); console.log(new Date()); pos= bulk.indexOf("788bbd6b12d79a4ee18e36a8a264fb496465c71b7932a965ed731397b7c97d14"); console.log(pos); console.log(new Date());
209715266 debugger eval code:1:1
Date 2018-04-28T00:08:30.231Z debugger eval code:1:27
209715202 debugger eval code:1:139
Date 2018-04-28T00:08:30.252Z debugger eval code:1:157
That's about 0.021 seconds for however Firefox implements String.indexOf().
$ dd if=/dev/urandom of=200mb.dat bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 2.98279 s, 70.3 MB/s
$ echo 788bbd6b12d79a4ee18e36a8a264fb496465c71b7932a965ed731397b7c97d14 >>200mb.dat
$ time grep -o 788bbd6b12d79a4ee18e36a8a264fb496465c71b7932a965ed731397b7c97d14 <200mb.dat
Binary file (standard input) matches
real 0m0.056s
user 0m0.028s
sys 0m0.028s
That's not too terribly different.
- fao_ 9y agoSomething feels off about this, but I can't put my finger on it.