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

Analyze "standardize function" computational cost #2

Open
brodriguez8774 opened this issue May 30, 2022 · 1 comment
Open

Analyze "standardize function" computational cost #2

brodriguez8774 opened this issue May 30, 2022 · 1 comment
Labels
question Further information is requested

Comments

@brodriguez8774
Copy link
Owner

Testing classes have several "standardize_x()" functions. These use regex to replace characters to the most common formats.

It made sense to have a majority of the "symbol" types, as I've had personal experience with Django templates outputting unexpected formats, which make tests fail when technically the character I expect is being output to the page.

Note sure if it makes sense to have standardization for the "number" and "letter" types, but they were added for completeness.


Anyways, to accomplish this, the functions are running many re.sub() replacement calls (one for each character type it can replace), which in theory may (potentially?) take up a non-negligible number of computations when analyzing large pages. And thus it could theoretically cause tests to slowdown and execute slower than they should.

But this is entirely untested at the moment. I have no idea how efficient Python's re.sub() calls are. And the matches are fairly simple so the hope is that the cost to run them is almost negligible. Needs testing at some point regardless, to check just how time-expensive these are to run. Preferably test on both very small pages and very large pages.

@brodriguez8774 brodriguez8774 added the question Further information is requested label May 30, 2022
@brodriguez8774
Copy link
Owner Author

Note: The expectation is that these (probably) don't take that much time to run, even on larger pages. But in big projects that have potentially thousands and thousands of tests, even a few seconds can add up. These functions are expected to be used very frequently so time-cost is worth considering.

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

No branches or pull requests

1 participant