You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
Add toString() comparison.
This commit is contained in:
@@ -1,10 +1,31 @@
|
||||
var source = new Buffer(100),
|
||||
dest = new Buffer(100), i, j, k, count = 1000000, bytes = 100;
|
||||
dest = new Buffer(100), i, j, k, tmp, count = 1000000, bytes = 100;
|
||||
|
||||
for (i = 99 ; i >= 0 ; i--) {
|
||||
source[i] = 120;
|
||||
}
|
||||
|
||||
for (i = bytes ; i > 0 ; i --) {
|
||||
var start = new Date();
|
||||
for (j = count ; j > 0; j--) {
|
||||
tmp = source.toString("ascii", 0, bytes);
|
||||
}
|
||||
var end = new Date();
|
||||
console.log("toString() " + i + " bytes " + (end - start) + " ms");
|
||||
}
|
||||
|
||||
for (i = bytes ; i > 0 ; i --) {
|
||||
var start = new Date();
|
||||
for (j = count ; j > 0; j--) {
|
||||
tmp = "";
|
||||
for (k = 0; k <= i ; k++) {
|
||||
tmp += String.fromCharCode(source[k]);
|
||||
}
|
||||
}
|
||||
var end = new Date();
|
||||
console.log("manual string " + i + " bytes " + (end - start) + " ms");
|
||||
}
|
||||
|
||||
for (i = bytes ; i > 0 ; i--) {
|
||||
var start = new Date();
|
||||
for (j = count ; j > 0 ; j--) {
|
||||
|
Reference in New Issue
Block a user