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

perf: expose isPointInPolygon and make 40% faster (at least in JIT mode) #1907

Merged
merged 4 commits into from
Jun 6, 2024

Commits on Jun 5, 2024

  1. Make isPointInPolygon 40% faster (at least in JIT mode).

    I mostly looked at the function because I wanted to use it myself but it
    was private. So I thought, if I expose it then I could at least put a
    ribbon on it by adding a benchmark.
    
    Before:
    
      (duration: 0:00:05.998949, name: In circle)
      (duration: 0:00:06.866919, name: Not in circle)
    
    After:
    
      (duration: 0:00:03.649496, name: In circle)
      (duration: 0:00:04.611599, name: Not in circle)
    
    Note, I opportunistically touched crs to remove the dart:ui dependency.
    This way it can be compiled with dart (w/o flutter) rendering the
    instructions in the benchmark correct again. Unfortunately,
    pointInPolygon is not so fortunate and needs flutter due to
    the dependency on ui.Offset. That's why I could only run it with
    "flutter test" in JIT mode.
    ignatz committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    7b19a6a View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2024

  1. Configuration menu
    Copy the full SHA
    306338c View commit details
    Browse the repository at this point in the history
  2. Rename pointInPolygon to isPointInPolygon, reduce copies and fix "is …

    …point in hole" computation.
    barfootsies committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    0f01a8b View commit details
    Browse the repository at this point in the history
  3. Add an assert (open to other means of handling) to validate isPointIn…

    …Polygon inputs. Would have caught previous misuse.
    barfootsies committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    bb3f8be View commit details
    Browse the repository at this point in the history