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

I should not see /REGEXP/ is considerably slower than the non-RegExp variant #94

Closed
Ichaelus opened this issue May 20, 2019 · 1 comment

Comments

@Ichaelus
Copy link

It surely does not come as a surprise, but matching DOM elements based on a regular expression is way slower than by compared to simple text matching. Nevertheless, I observed that especially the "not" combination can make a testsuite painfully slow and would propose looking into it.

Reason why

This means non-blanking spaces will no longer be collapsed, carriage returns may be returned in text strings, etc. This affects not only the Node#text method but also methods that take a :text option as well as the text related predicates, assertions, and matchers (has_text?, has_content?, assert_text, have_text, etc.).

  • This seems to be a little impractical to us, since it differs the way the HTML and Browser correlate: While text might be be split across multiple lines in the HTML, the user might see it in a single line in the browser.
  • Ultimately, it led to an increased usage of steps like I should see /my text\s+split across multiple lines/ for me.

Well, and since the step I should not see // "patiently" traverses the entire DOM with .//descendant-or-self::*, executing it takes some precious time on large HTML pages.

@makmic
Copy link
Member

makmic commented May 23, 2019

The root cause of my problen has been sepearately inspected and solved in #95. As I do no longer see an immediate need to look into this, I'll close this issue for now.

@makmic makmic closed this as completed May 23, 2019
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

2 participants