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

Add Route Resolution Benchmarking to Unit Test #1499

Conversation

harshanarayana
Copy link
Contributor

@harshanarayana harshanarayana commented Feb 23, 2019

Description

This PR adds a set of test cases that serve as the sample benchmarking mechanism for each of the sanic's individual components.

As part of this initial cut of the attempt, it leverages the pytest-benchmark plugin to test and benchmark the route resolution mechanism employed by sanic.

Sample Output

------------------------------------------------------------------------------------------------- benchmark: 2 tests -------------------------------------------------------------------------------------------------
Name (time in ns)                              Min                   Max                Mean             StdDev              Median                IQR            Outliers  OPS (Mops/s)            Rounds  Iterations
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_resolve_route_no_arg_string_path     151.7620 (1.0)        397.6730 (1.0)      170.8607 (1.02)     33.5440 (1.0)      157.6000 (1.00)      5.1415 (1.0)       112;193        5.8527 (0.98)       1000        1000
test_resolve_route_with_typed_args        152.1700 (1.00)     1,138.8840 (2.86)     168.0992 (1.0)      42.5012 (1.27)     156.8525 (1.0)      12.2375 (2.38)       74;130        5.9489 (1.0)        1000        1000
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This PR replaces a different idea proposed in #1439

Note

This PR also does some cleanup for the existing test

@codecov
Copy link

codecov bot commented Feb 23, 2019

Codecov Report

Merging #1499 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1499   +/-   ##
=======================================
  Coverage   91.45%   91.45%           
=======================================
  Files          17       17           
  Lines        1731     1731           
  Branches      330      330           
=======================================
  Hits         1583     1583           
  Misses        123      123           
  Partials       25       25

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52deeba...a53d61b. Read the comment docs.

@sjsadowski sjsadowski merged commit 34fe26e into sanic-org:master Feb 28, 2019
@ahopkins
Copy link
Member

ahopkins commented Mar 5, 2019

Well done!

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.

3 participants