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

call to testing.T.Helper() slows down execution #766

Open
funny-falcon-at-joomcode opened this issue May 16, 2019 · 2 comments
Open

call to testing.T.Helper() slows down execution #766

funny-falcon-at-joomcode opened this issue May 16, 2019 · 2 comments

Comments

@funny-falcon-at-joomcode

Currently every assertion function calls to testing.T.Helper() unconditionally.
testing.T.Helper() collects function name from stack trace, and it is quite expensive operation.
And go 1.12 collects traces even slower than go 1.11, therefore tests became to be slower.

There is no need to call testing.T.Helper() if assertion is satisfied, therefore I propose to move call to Helper to failing case instead of unconditional call.

@MaxInertia
Copy link

I just switched our tests from the standard func TestX(t *testing.T) to testify suites func (suite *MyTestSuite) TestX() and noticed the tests are taking considerably longer. If this is the source of that increased time it would be excellent to have this changed.

@bboreham
Copy link
Contributor

Should be improved by golang/go#38834, once the next version of Go comes out.

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

3 participants