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

DEV-6326 Allow custom functions to be benchmarked #239

Merged
merged 6 commits into from Apr 23, 2020
Merged

Conversation

JosVerburg
Copy link
Member

Please make sure to review the compare.benchmark.ts carefully. It's important that the "manual" code does the same as the "xpath" version. I've already confirmed that the end result of both are equal.

@coveralls
Copy link

coveralls commented Apr 21, 2020

Pull Request Test Coverage Report for Build 2197

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.385%

Totals Coverage Status
Change from base Build 2154: 0.0%
Covered Lines: 7785
Relevant Lines: 8125

💛 - Coveralls

}
})
.resume();
}).listen(8080);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be useful to assign the port number manually: npm run performance-server --port 8181. But I think we can do this together with https://github.com/FontoXML/fontoxpath/blob/master/demo/server.ts#L35

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean to do it together with the other one? Is there a story or an issue to make that one configurable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this is not easily doable. https://github.com/kimmobrunfeldt/concurrently/issues/33
I'd prefer to just keep 8080 as static port number for now as is also done in the demo/server.ts you linked.
If you want to have support for this than I suggest that we create a separate issue for this, if you do so please also include the github issue I referenced as the library "concurrently" which we are using now creates the problem.

): void {
this._benchmarks.push({
benchmark: new Benchmark(name, test),
// We do not use the setup and teardown which is offered withing the API of benchmarkjs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

within*

@mehmetscoskun
Copy link
Contributor

when I run npm run performance, it will run all performance tests, right? Is it too hard to add something like this: runner.only.addBenchmark or runner.only.compareBenchmark . Maybe this one can take time but we can pass an option like this {only: true/false, skip:true/false} to addBenchmark and compareBenchmark functions. I think it would be useful. at least in the future

API has the same format as we're used from unit tests
@JosVerburg
Copy link
Member Author

@mehmetscoskun I've added the API to run only 1 performance benchmark. This is the runner.only.addBenchmark format. You can check the latest commit for this.

@@ -1,5 +1,6 @@
/coverage
/node_modules
/performance/lib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please verify whether this folder will not be included in a publish

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check it with an npm build and npm pack could not see signs of the benchmark tooling in either.

performance/types/slimdom-sax-parser.d.ts Outdated Show resolved Hide resolved
"extends": ["../tslint.json"],
"rules": {
"no-console": false,
"no-implicit-dependencies": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the tests. It's needed to import benchmark. Seems to not like using dev-dependencies.

Copy link
Member

@DrRataplan DrRataplan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left some small pieces of feedback. LGTM!

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

Successfully merging this pull request may close these issues.

None yet

4 participants