Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can benchmarks be runnable without node? #18

Closed
Yaffle opened this issue Sep 7, 2014 · 9 comments
Closed

can benchmarks be runnable without node? #18

Yaffle opened this issue Sep 7, 2014 · 9 comments

Comments

@Yaffle
Copy link
Contributor

Yaffle commented Sep 7, 2014

  1. I have "0.00" ops/sec for all libs. Seems, "benchmark.js" does not work well under node.js for me.
  2. I have no "python", so i cannot install some libs for benchmark.

It is still interesting to compare performance under web browsers.
Can the benchmark be rewritten, so it will be possible to run it under Chrome or Firefox or ... AND this will still be same benchmark?

@indutny
Copy link
Owner

indutny commented Sep 7, 2014

Hm... it does work pretty well for me, what node.js version are you using?

I think it could be, with a help of browserify! Do you want to help me with this? ;)

@Yaffle
Copy link
Contributor Author

Yaffle commented Sep 20, 2014

Add next 4 lines to the index.js:

// "browserify" will set bignum to "stub"
if (typeof bignum === "object") {
  bignum = bbignum;
}

npm install browserify
browserify index.js --ignore bignum -o index.min.js
create index.html:

var console = {
  log: function (t) {
    document.body.insertAdjacentHTML("beforeend", "<br />" + t);
  }
};

setTimeout(function () {
  var script = document.createElement("script");
  script.src = "i.js";
  document.querySelector("script").parentNode.appendChild(script);
}, 10);

But
benchmark.js works very sadly for me - it takes very long time to execute, do you know how to configure it?

@indutny
Copy link
Owner

indutny commented Sep 23, 2014

I guess benchmark.options.maxTime or something like that. It is worth noting, though, that the quality of values really depend on the time of execution.

Mind opening a PR for browserify fixes? (Or have you already done it...)

@indutny indutny closed this as completed Sep 23, 2014
@Yaffle
Copy link
Contributor Author

Yaffle commented Sep 23, 2014

@indutny , i tried with benchmark.options.maxTime with no good result.

@indutny
Copy link
Owner

indutny commented Sep 23, 2014

Yeah, looks like it is not enough. Try adding minSamples = 2 too.

@Yaffle
Copy link
Contributor Author

Yaffle commented Sep 23, 2014

@indutny , i tried with minSamples = 16, minSamples = 128; seems, a little better, but too long anyway.

@indutny
Copy link
Owner

indutny commented Sep 23, 2014

Yeah, I'd suggest taking a look at benchmark source then.

@Yaffle
Copy link
Contributor Author

Yaffle commented Sep 26, 2014

@indutny , Ok, i checked with your last changes, seems it works, "create"+"create-hex" takes ~40 seconds...
But seems, "benchmark.js" works not good after "browserify", because:

  1. it cannot get correct "window" object;
  2. async tests are not supported, so you need to wait before any result will be displayed.

@Yaffle
Copy link
Contributor Author

Yaffle commented Sep 27, 2014

@indutny
I have to modify "index.js" a little to support "async":
https://github.com/Yaffle/bn.js/commit/e2649d23aff58b33a44476ad0756854dfa66a54b

Please look at result here:
http://yaffle.github.io/bn.js/benchmarks/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants