Skip to content

suite: faster methods filtering (internal refactor) #1758

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dolmen
Copy link
Collaborator

@dolmen dolmen commented May 30, 2025

Summary

In package suite, speed-up the filtering of methods (-testify.m flag) by compiling the regexp just once instead of when checking each method.

Changes

  • faster filtering of suite methods which are tests by using strings.HasPrefix instead of a ^Test regexp compiled for every checked method
  • faster filtering when -testify.m is given: compile the regexp once

Motivation

Runtime speed!

Related issues

N/A

@dolmen dolmen self-assigned this May 30, 2025
@dolmen dolmen added pkg-suite Change related to package testify/suite internal/optimization Improve speed or reduce memory usage internal/refactor Refactor internals with no external visible changes labels May 30, 2025
@dolmen dolmen changed the title Dolmen/suite faster method filtering suite: faster method filtering (internal refactor) May 30, 2025
@dolmen dolmen changed the title suite: faster method filtering (internal refactor) suite: faster methods filtering (internal refactor) May 30, 2025
@dolmen dolmen force-pushed the dolmen/suite-faster-method-filtering branch from baeed2b to 6ce76f9 Compare June 1, 2025 21:37
@dolmen dolmen requested a review from brackendawson June 5, 2025 07:54
dolmen added 2 commits June 16, 2025 16:38
Use strings.HasPrefix instead of a /^Test/ regexp (compiled on every call).
Refactor filtering of methods in suite.Run: the regexp given via
-testify.m flag is compiled just once, out of the loop.
@dolmen dolmen force-pushed the dolmen/suite-faster-method-filtering branch from 6ce76f9 to b2caf47 Compare June 16, 2025 14:40
@dolmen dolmen requested a review from ccoVeille June 16, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal/optimization Improve speed or reduce memory usage internal/refactor Refactor internals with no external visible changes pkg-suite Change related to package testify/suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants