Permalink
Browse files

updated 'json' option of http client to use eval instead of JSON.pars…

…e. eval is much faster in benchmarking so far
  • Loading branch information...
Nathan Nathan
Nathan authored and Nathan committed Oct 21, 2009
1 parent 75db060 commit 0db1e9c908ed9a6d9ed4171b880a4da16070528d
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/couchdb/http_client.js
@@ -45,7 +45,8 @@ HttpClient.prototype = (function() {
if (req.status >= 200 && req.status < 300 && opts.success){
var results = req.responseText;
if (opts.dataType && opts.dataType.toLowerCase() === "json"){
- results = JSON.parse(results);
+ //results = JSON.parse(results);
+ eval("var results = " + results); // Is there a better way than eval? JSON.parse is way slower.
} else if (opts.dataType && opts.dataType.toLowerCase() == "raw") {
results = req.responseRaw;
}

0 comments on commit 0db1e9c

Please sign in to comment.