-
Notifications
You must be signed in to change notification settings - Fork 305
Closed
Description
- **Node.js Version 8.94:
- OS: Win7 64
I think v8.serialize will be faster than JSON... but not?
and
v8.serialize(value) is slower than v8.serialize(value).toString()
Plz test the codes below;
// I am an example of JS code
var deco_getSyncRunTime = function(func, times){
var t = Date.now();
for(var i=0; i<times; i++){
func();
}
console.log('run time:', Date.now() - t);
console.log(process.memoryUsage());
}
var v8 = require('v8');
var test_func_1 = function(){
return v8.serialize(obj).toString(); //1e6 11sec
}
var test_func_2 = function(){
return v8.serialize(obj); //1e6 21sec why
}
var obj = {"dirty_map":{"pid":1},"pid":1,"uid":"","wid":"","phone":"","wechat":"","currency_1":3000,"char_1":{"dirty_map":{"money":1},"money":5}};
setTimeout(function(){
deco_getSyncRunTime(test_func_1, 1e6);
//deco_getSyncRunTime(test_func_2, 1e6);
}, 1e4);
-->Metadata
Metadata
Assignees
Labels
No labels