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 speed metric tests #41

Open
Vlek opened this issue Jun 21, 2021 · 1 comment
Open

Add speed metric tests #41

Vlek opened this issue Jun 21, 2021 · 1 comment
Assignees
Labels
testing Testing

Comments

@Vlek
Copy link
Owner

Vlek commented Jun 21, 2021

One of the main things that I stated were important to me going into this project is that it should be fast. While I have attempted to code in such a way that it makes the project efficient, I do not currently have any tests set up specifically for capturing how fast different aspects of the code work.

Proposed additional tests:

  • Test the overall speed of the project from import all the way to getting a dice roll
  • Test the underlying rolling functions
  • Test the functions when called through Click

Considerations:

  • It is likely going to be difficult to test how quick these things are as a CLI command because likely a good portion of the time that is spent is by Python itself getting everything loaded such that it can run our code.
    • I think though that, since we cannot really change that fact, we should really focus on the time that it takes to go from importing our code all the way to rolling a dice as our metric since that's what we control.

Why we should do this:

  • I think that this is going to be leveraged heavily on whether or not changing certain elements of the code to Cython (Convert parser to Cython #29) is beneficial and will allow us to better state exactly how beneficial it actually is rather than simply "it seems faster", especially as that feeling may be in part due to expectations and not based in reality.

How:

  • I think this can be done via pytest using something like the built-in timeit library. We can probably do warnings if code gets slower than it currently is and completely fail the code if it takes too much time.
    • The concept of too much time and whether something is slower than the current time are both things that I will likely have to figure out through testing. I want the rolls to generally feel instantaneous. For websites to feel that way, they generally have to be under 700ms from memory.
@Vlek Vlek self-assigned this Jun 21, 2021
@Vlek Vlek added the testing Testing label Jun 21, 2021
@Vlek
Copy link
Owner Author

Vlek commented Jul 13, 2021

Here's a good read on how to do performance testing in python:
https://therenegadecoder.com/code/how-to-performance-test-python-code/

Here are two libraries that we may want to run to figure out where the bottlenecks are both in terms of memory usage and performance:
https://github.com/pyutils/line_profiler
https://pypi.org/project/memory-profiler/

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

No branches or pull requests

1 participant