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

speed up CSS class queries #2137

Merged
merged 10 commits into from
Dec 18, 2020
Merged

speed up CSS class queries #2137

merged 10 commits into from
Dec 18, 2020

Commits on Dec 18, 2020

  1. Configuration menu
    Copy the full SHA
    7b76dc7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2145f9d View commit details
    Browse the repository at this point in the history
  3. feat: provide an XPath function for fast CSS class lookup

    available as `nokogiri-builtin:css-class`
    
    Part of #2135
    flavorjones committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    7566d4b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    91d6187 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    671fd2f View commit details
    Browse the repository at this point in the history
  6. style: overhauled CSS parser tests to be more readable

    and consolidated the XPathVisitor tests from css/test_parser.rb into
    css/test_xpath_visitor.rb so we're testing xpath visitor behavior in
    one place.
    flavorjones committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    206ac73 View commit details
    Browse the repository at this point in the history
  7. refactor: simplify XPath translation of the CSS ~= operator

    This is consistent with the class selector ".", and should be faster
    because it's doing less string manipulation in the XPath query.
    flavorjones committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    4d3eb8e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4af18dc View commit details
    Browse the repository at this point in the history
  9. feat: Introduce variations of CSS::XPathVisitor that use builtins

    This allows us to continue to generate XPath that uses standard XPath
    functions, but also allow us to inject the preference to use the
    optimized builtin implementation.
    
    This also leaves open a path to extracting Nokogiri's CSS parser into
    a separate gem, and allowing Nokogiri to inject builtin via a custom
    XPathVisitor class.
    flavorjones committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    9f5bb99 View commit details
    Browse the repository at this point in the history
  10. feat: CSS queries use builtins if they are more performant

    Notably, on libxml2 CSS class queries are now ~2x faster using the
    `nokogiri-builtin:css-class` function.
    
    Closes #2135
    flavorjones committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    5d0b7fe View commit details
    Browse the repository at this point in the history