Skip to content

Avoid tiny numpy arrays in numba: optimize intersections.py (and refactor: "un-scalarize") - #1727

Draft
Sevans711 wants to merge 3 commits into
mainfrom
sevans/tinynumpynumba-optimize-intersections.py
Draft

Avoid tiny numpy arrays in numba: optimize intersections.py (and refactor: "un-scalarize")#1727
Sevans711 wants to merge 3 commits into
mainfrom
sevans/tinynumpynumba-optimize-intersections.py

Conversation

@Sevans711

Copy link
Copy Markdown
Collaborator

Closes #1726 (sub-issue of #1648)

Overview

Optimizes numba routines in uxarray/grid/intersections.py to avoid constructing many tiny numpy arrays inside numba routines, as discussed in #1648. Did not test performance improvements locally yet; keeping as draft PR until checking ASV benchmarks results.

Additionally, refactors the intersections.py routines to restore prior behavior (from before #1688 merged) of using 3-vector inputs and outputs where possible. To maintain performance improvements, just use tuples instead of allocating tiny numpy arrays. The discussion in PR 1688 clarified the intent was to restore to the pre-scalarized function interfaces where possible without sacrificing performance.

A few changes are within scope of the original issue but the reasoning is not necessarily obvious directly from inspecting the code diff; clarifying here:

  • Previously, gca_gca_intersection output (len(result) == number of intersections) did not match its docstring, which promised shape (2,3) result but filling unused rows with NaNs. This PR updates the implementation to fill unused rows with NaNs, and always return a tuple of 2 length-3 tuples, like ((x1,y1,z1),(x2,y2,z2)), filling with NaNs to represent nonexistent intersection points. (The consistent shape is necessary for the performance optimization here. Numba complains that it "Can't unify return type" if the output length depends on the number of intersections.) The test suite has been updated accordingly, to check for nans instead of len(result).
    • Also updated the docstring of get_number_of_intersections to clarify that it could now be applied to results from gca_gca_intersection too.
  • Removes scalarized versions of methods where non-scalarized versions now suffice. I.e., removed _accux_constlat_scalar (use _accux_constlat instead), and _snap_const_lat_endpoint_xy (use _snap_const_lat_endpoint instead). By using tuples instead of tiny numpy arrays, the "non-scalar" versions also avoid allocation costs, so there is no performance-related need to continue maintaining the scalarized versions.
  • Similarly, updated arcs.py, removing _on_minor_arc_xyz by moving its logic into on_minor_arc, since the scalarized version wasn't being used anywhere anymore (except in benchmarking suite, which has been updated appropriately to use on_minor_arc). Updated on_minor_arc docstring to clarify inputs don't need to be numpy arrays; tuples of length 3 also work just fine.
  • Improved various docstrings, updating docstrings where needed to explain new behavior, but also adding to existing docstrings to clarify meanings and expectations about inputs and outputs, and removing now-obsolete notes about preferring scalarized versions.

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • There is adequate test coverage of changes from this PR (add new tests if needed)
  • If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation and Examples

  • Docstrings updated with any function changes, and included in all new functions
  • User (public) functions added to docs/api.rst; internal (private) function names start with an underscore (_)
  • [N/A] If touched any notebook files, cleared the output of all cells before committing
  • [N/A] If added new notebook files, put into appropriate directories and referenced in appropriate files

AI Disclosure

AI Usage: GitHub Copilot's inline code suggestions, plus some Claude for numba debugging questions

  • I have tested and take responsibility for all AI-generated content in my PR.

undo many changes from #1688 because tuples are easier to read than scalars, and maintain all performance improvements. (There was some intent there to refactor back to vectors, but it got merged before that happened, with the intent to refactor being pushed as something to be handled later.)

Also optimizes to avoid creating numpy array of shape (2,3) for every gca_gca_intersection() call.

And, updates gca_gca_intersection() output to always be a tuple of 2 length-3 tuples, filling with NaNs, as promised in the docstring, instead of a numpy array with shape depending on number of intersections.
and other relevant intersections methods. Removes scalarized versions of related methods: _accux_constlat_scalar, _snap_const_lat_endpoint_xy, _on_minor_arc_xyz,  (if you really want to provide a bunch of scalars, just convert to tuples at call site; using tuples has the same performance as a scalarized implementation but it means there is no longer any need to maintain two versions of each method.)
@Sevans711 Sevans711 self-assigned this Sep 1, 2026
@Sevans711 Sevans711 added scalability Related to scalability & performance efforts run-benchmark Run ASV benchmark workflow labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

ASV Benchmarking

Benchmark Comparison Results

Benchmarks that have improved:

Change Before [5e8021d] After [2baee7e] Ratio Benchmark (Parameter)
- 1.56±0.04μs 686±20ns 0.44 geometry_kernels.GCAConstLatIntersection.time_accux_constlat_kernel
- 1.14±0.02μs 771±30ns 0.68 geometry_kernels.GCAConstLatIntersection.time_gca_const_lat_intersection
- 1.93±0.04μs 822±40ns 0.43 geometry_kernels.GCAConstLatIntersection.time_try_gca_const_lat_intersection
* failed 846±30ns n/a geometry_kernels.GCAGCAIntersection.time_accux_gca_kernel
* failed 882±20ns n/a geometry_kernels.GCAGCAIntersection.time_gca_gca_intersection
* failed 1.06±0.03μs n/a geometry_kernels.GCAGCAIntersection.time_try_gca_gca_intersection

Benchmarks that have stayed the same:

Change Before [5e8021d] After [2baee7e] Ratio Benchmark (Parameter)
192±0.5ms 193±1ms 1.01 bench_connectivity.Connectivity.time_edge_face('120km')
11.8±0.04ms 11.8±0.05ms 1.00 bench_connectivity.Connectivity.time_edge_face('480km')
193±2ms 192±1ms 0.99 bench_connectivity.Connectivity.time_edge_node('120km')
10.8±0.04ms 10.8±0.05ms 1.00 bench_connectivity.Connectivity.time_edge_node('480km')
192±0.6ms 191±0.4ms 1.00 bench_connectivity.Connectivity.time_face_edge('120km')
11.2±0.08ms 11.3±0.09ms 1.01 bench_connectivity.Connectivity.time_face_edge('480km')
883±7ms 890±10ms 1.01 bench_connectivity.Connectivity.time_face_face('120km')
55.6±0.4ms 57.0±0.7ms 1.03 bench_connectivity.Connectivity.time_face_face('480km')
69.1±2μs 68.9±2μs 1.00 bench_connectivity.Connectivity.time_face_node('120km')
68.7±3μs 69.9±3μs 1.02 bench_connectivity.Connectivity.time_face_node('480km')
418±9μs 428±9μs 1.02 bench_connectivity.Connectivity.time_n_nodes_per_face('120km')
352±10μs 354±9μs 1.01 bench_connectivity.Connectivity.time_n_nodes_per_face('480km')
194±1ms 193±2ms 1.00 bench_connectivity.Connectivity.time_node_edge('120km')
11.3±0.06ms 11.2±0.06ms 0.99 bench_connectivity.Connectivity.time_node_edge('480km')
5.32±0.3ms 5.26±0.04ms 0.99 bench_connectivity.Connectivity.time_node_face('480km')
7.94±0.07ms 8.55±0.2ms 1.08 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
2.57±0.09ms 2.76±0.05ms 1.08 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
10.4±10s 10.1±10ms ~0.00 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
2.17±0.02ms 2.14±0.03ms 0.98 face_bounds.FaceBounds.time_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
57.3k 57.3k 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
12.3k 12.3k 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
123k 123k 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
128 128 1.00 face_bounds.FaceBounds.track_nbytes_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.27M 1.27M 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
50.1k 50.1k 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
1.48M 1.48M 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
712 712 1.00 face_bounds.FaceBounds.track_nbytes_grid_with_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.97M 1.99M 1.01 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
1.97M 2M 1.01 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
2.14M 2.16M 1.01 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
38.3k 38.3k 1.00 face_bounds.FaceBounds.track_peakmem_face_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
336M 336M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/mpas/QU/oQU480.231010.nc'))
368M 366M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/scrip/outCSne8/outCSne8.nc'))
338M 338M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/geoflow-small/grid.nc'))
338M 339M 1.00 face_bounds.FaceBoundsColdStartRss.peakmem_open_and_bounds(PosixPath('/home/runner/work/uxarray/uxarray/test/meshfiles/ugrid/quad-hexagon/grid.nc'))
1.19±0.03μs 1.28±0.03μs 1.08 geometry_kernels.AccucrossKernels.time_accucross
2.79±0.1μs 2.78±0.07μs 1.00 geometry_kernels.AccucrossKernels.time_accucross_pair
440±20ns 441±30ns 1.00 geometry_kernels.EFTPrimitives.time_acc_sqrt_re
421±10ns 451±20ns 1.07 geometry_kernels.EFTPrimitives.time_diff_of_products
361±20ns 386±10ns 1.07 geometry_kernels.EFTPrimitives.time_two_prod
355±10ns 366±20ns 1.03 geometry_kernels.EFTPrimitives.time_two_sum
54.0±0.4μs 52.5±0.4μs 0.97 geometry_kernels.OrientPredicates.time_on_minor_arc
1.08±0.02μs 1.10±0.02μs 1.02 geometry_kernels.OrientPredicates.time_orient3d_on_sphere
failed failed n/a geometry_samebody.SameBodyConstLat.time_accux_dispatch
failed failed n/a geometry_samebody.SameBodyConstLat.time_accux_kernel
failed failed n/a geometry_samebody.SameBodyConstLat.time_fp64_dispatch
failed failed n/a geometry_samebody.SameBodyConstLat.time_fp64_kernel
29.6±0ms 29.6±0.01ms 1.00 geometry_samebody_gcagca.SameBodyGcaGca.time_accux_dispatch
6.30±0ms 6.32±0.01ms 1.00 geometry_samebody_gcagca.SameBodyGcaGca.time_accux_kernel
38.7±0ms 39.0±0.07ms 1.01 geometry_samebody_gcagca.SameBodyGcaGca.time_fp64_dispatch
4.87±0ms 5.04±0.07ms 1.03 geometry_samebody_gcagca.SameBodyGcaGca.time_fp64_kernel
823±7ms 840±10ms 1.02 import.Imports.timeraw_import_uxarray
293M 293M 1.00 import.Imports.track_peakmem_import_uxarray
2.71±0.03ms 2.80±0.01ms 1.03 mpas_ocean.CheckNorm.time_check_norm('120km')
2.25±0.02ms 2.27±0.02ms 1.01 mpas_ocean.CheckNorm.time_check_norm('480km')
826±10ms 837±10ms 1.01 mpas_ocean.ConnectivityConstruction.time_face_face_connectivity('120km')
53.6±0.6ms 53.9±1ms 1.01 mpas_ocean.ConnectivityConstruction.time_face_face_connectivity('480km')
667±10μs 669±20μs 1.00 mpas_ocean.ConnectivityConstruction.time_n_nodes_per_face('120km')
590±10μs 595±10μs 1.01 mpas_ocean.ConnectivityConstruction.time_n_nodes_per_face('480km')
5.41±0.01ms 5.44±0.03ms 1.01 mpas_ocean.ConstructFaceLatLon.time_cartesian_averaging('120km')
3.90±0.05ms 3.97±0.04ms 1.02 mpas_ocean.ConstructFaceLatLon.time_cartesian_averaging('480km')
99.2±0.4ms 99.5±0.3ms 1.00 mpas_ocean.ConstructFaceLatLon.time_welzl('120km')
10.8±0.06ms 10.7±0.2ms 0.99 mpas_ocean.ConstructFaceLatLon.time_welzl('480km')
18.2±0.02ms 18.2±0.01ms 1.00 mpas_ocean.ConstructTreeStructures.time_ball_tree('120km')
1.04±0.01ms 1.06±0.01ms 1.02 mpas_ocean.ConstructTreeStructures.time_ball_tree('480km')
10.6±0.03ms 10.6±0.02ms 1.00 mpas_ocean.ConstructTreeStructures.time_kd_tree('120km')
715±10μs 740±10μs 1.03 mpas_ocean.ConstructTreeStructures.time_kd_tree('480km')
573±2ms 586±6ms 1.02 mpas_ocean.CrossSections.time_const_lat('120km', 1)
293±1ms 295±3ms 1.01 mpas_ocean.CrossSections.time_const_lat('120km', 2)
152±0.6ms 151±2ms 0.99 mpas_ocean.CrossSections.time_const_lat('120km', 4)
525±2ms 540±3ms 1.03 mpas_ocean.CrossSections.time_const_lat('480km', 1)
263±1ms 268±3ms 1.02 mpas_ocean.CrossSections.time_const_lat('480km', 2)
137±2ms 139±1ms 1.01 mpas_ocean.CrossSections.time_const_lat('480km', 4)
356M 356M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('120km', 1)
358M 356M 0.99 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('120km', 2)
356M 356M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('120km', 4)
339M 339M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('480km', 1)
339M 339M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('480km', 2)
339M 339M 1.00 mpas_ocean.CrossSectionsPeakMem.peakmem_const_lat('480km', 4)
25.3±0.4ms 25.2±0.07ms 1.00 mpas_ocean.DualMesh.time_dual_mesh_construction('120km')
3.35±0.1ms 3.49±0.05ms 1.04 mpas_ocean.DualMesh.time_dual_mesh_construction('480km')
61.7±0.2ms 62.0±2ms 1.01 mpas_ocean.FaceAreas.time_face_areas('120km')
4.89±5s 7.78±5ms ~0.00 mpas_ocean.FaceAreas.time_face_areas('480km')
229k 229k 1.00 mpas_ocean.FaceAreas.track_nbytes_face_areas('120km')
14.3k 14.3k 1.00 mpas_ocean.FaceAreas.track_nbytes_face_areas('480km')
2.12M 2.12M 1.00 mpas_ocean.FaceAreas.track_peakmem_face_areas('120km')
823k 823k 1.00 mpas_ocean.FaceAreas.track_peakmem_face_areas('480km')
946±10ms 945±6ms 1.00 mpas_ocean.GeoDataFrame.time_to_geodataframe('120km', False)
54.1±2ms 55.2±2ms 1.02 mpas_ocean.GeoDataFrame.time_to_geodataframe('120km', True)
83.8±0.2ms 84.4±0.4ms 1.01 mpas_ocean.GeoDataFrame.time_to_geodataframe('480km', False)
5.70±0.2ms 5.89±0.09ms 1.03 mpas_ocean.GeoDataFrame.time_to_geodataframe('480km', True)
180±3ms 177±5ms 0.98 mpas_ocean.Gradient.time_gradient('120km')
12.3±0.2ms 12.6±0.06ms 1.02 mpas_ocean.Gradient.time_gradient('480km')
457k 457k 1.00 mpas_ocean.Gradient.track_nbytes_gradient('120km')
28.7k 28.7k 1.00 mpas_ocean.Gradient.track_nbytes_gradient('480km')
5.08M 5.08M 1.00 mpas_ocean.Gradient.track_peakmem_gradient('120km')
328k 328k 1.00 mpas_ocean.Gradient.track_peakmem_gradient('480km')
352M 352M 1.00 mpas_ocean.GradientColdStartRss.peakmem_gradient('120km')
332M 336M 1.01 mpas_ocean.GradientColdStartRss.peakmem_gradient('480km')
369±10μs 389±7μs 1.05 mpas_ocean.HoleEdgeIndices.time_construct_hole_edge_indices('120km')
201±4μs 201±9μs 1.00 mpas_ocean.HoleEdgeIndices.time_construct_hole_edge_indices('480km')
631±10μs 589±10μs 0.93 mpas_ocean.Integrate.time_integrate('120km')
488±10μs 505±6μs 1.03 mpas_ocean.Integrate.time_integrate('480km')
18.4M 18.4M 1.00 mpas_ocean.Integrate.track_nbytes_integrate('120km')
1.2M 1.2M 1.00 mpas_ocean.Integrate.track_nbytes_integrate('480km')
187±3ms 185±1ms 0.99 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'exclude')
184±3ms 184±2ms 1.00 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'include')
185±1ms 183±0.9ms 0.99 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('120km', 'split')
13.9±0.1ms 13.9±0.1ms 1.00 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'exclude')
13.7±0.05ms 14.1±0.2ms 1.03 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'include')
13.9±0.04ms 14.2±0.1ms 1.02 mpas_ocean.MatplotlibConversion.time_dataarray_to_polycollection('480km', 'split')
237±0.2ms 238±0.3ms 1.01 mpas_ocean.NeighborhoodBuild.time_build('120km', 1.0)
1.27±0s 1.27±0s 1.00 mpas_ocean.NeighborhoodBuild.time_build('120km', 15.0)
490±1ms 491±3ms 1.00 mpas_ocean.NeighborhoodBuild.time_build('120km', 5.0)
12.9±0.01ms 13.0±0.08ms 1.01 mpas_ocean.NeighborhoodBuild.time_build('480km', 1.0)
24.8±0.1ms 25.0±0.03ms 1.01 mpas_ocean.NeighborhoodBuild.time_build('480km', 15.0)
16.0±0.07ms 16.2±0.03ms 1.01 mpas_ocean.NeighborhoodBuild.time_build('480km', 5.0)
233±0.8ms 233±0.6ms 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('120km', 1.0)
1.25±0s 1.25±0s 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('120km', 15.0)
487±2ms 485±1ms 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('120km', 5.0)
12.6±0.05ms 12.6±0.04ms 1.00 mpas_ocean.NeighborhoodBuild.time_query_radius('480km', 1.0)
24.1±0.1ms 24.3±0.1ms 1.01 mpas_ocean.NeighborhoodBuild.time_query_radius('480km', 15.0)
15.7±0.07ms 15.8±0.2ms 1.01 mpas_ocean.NeighborhoodBuild.time_query_radius('480km', 5.0)
1.19 1.19 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('120km', 1.0)
612.76 612.76 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('120km', 15.0)
74.17 74.17 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('120km', 5.0)
1.0 1.0 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('480km', 1.0)
37.29 37.29 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('480km', 15.0)
6.57 6.57 1.00 mpas_ocean.NeighborhoodBuild.track_mean_neighbors('480km', 5.0)
728k 728k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('120km', 1.0)
141M 141M 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('120km', 15.0)
17.4M 17.4M 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('120km', 5.0)
43k 43k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('480km', 1.0)
563k 563k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('480km', 15.0)
123k 123k 1.00 mpas_ocean.NeighborhoodBuild.track_nbytes_neighbors('480km', 5.0)
5.72M 5.72M 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('120km', 1.0)
145M 145M 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('120km', 15.0)
21.5M 21.5M 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('120km', 5.0)
362k 362k 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('480km', 1.0)
825k 825k 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('480km', 15.0)
384k 384k 1.00 mpas_ocean.NeighborhoodBuild.track_peakmem_build('480km', 5.0)
44.8±0.4ms 44.2±0.5ms 0.99 mpas_ocean.NeighborhoodDask.time_mean('120km', 'grid_chunks')
22.6±0.06ms 22.7±0.1ms 1.00 mpas_ocean.NeighborhoodDask.time_mean('120km', 'numpy')
41.7±0.9ms 41.5±0.8ms 1.00 mpas_ocean.NeighborhoodDask.time_mean('120km', 'time_chunks')
12.2±0.05ms 12.1±0.2ms 1.00 mpas_ocean.NeighborhoodDask.time_mean('480km', 'grid_chunks')
711±10μs 707±20μs 0.99 mpas_ocean.NeighborhoodDask.time_mean('480km', 'numpy')
8.67±0.1ms 8.71±0.09ms 1.00 mpas_ocean.NeighborhoodDask.time_mean('480km', 'time_chunks')
5.84M 5.83M 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('120km', 'grid_chunks')
2.75M 2.75M 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('120km', 'numpy')
5.68M 5.68M 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('120km', 'time_chunks')
702k 763k 1.09 mpas_ocean.NeighborhoodDask.track_peakmem_mean('480km', 'grid_chunks')
177k 177k 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('480km', 'numpy')
532k 529k 1.00 mpas_ocean.NeighborhoodDask.track_peakmem_mean('480km', 'time_chunks')
12.3±0.01s 12.3±0s 1.00 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('120km', 'mean')
13.0±0s 12.9±0.01s 1.00 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('120km', 'median')
225±0.9ms 225±0.9ms 1.00 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('480km', 'mean')
234±0.6ms 234±2ms 1.00 mpas_ocean.NeighborhoodReduce.time_dataset_reduce('480km', 'median')
1.30±0s 1.30±0s 1.00 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('120km', 'mean')
1.49±0s 1.50±0s 1.00 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('120km', 'median')
25.7±0.2ms 25.1±0.1ms 0.98 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('480km', 'mean')
26.9±0.05ms 26.6±0.2ms 0.99 mpas_ocean.NeighborhoodReduce.time_neighborhood_reduce('480km', 'median')
40.2±0.05ms 40.1±0.04ms 1.00 mpas_ocean.NeighborhoodReduce.time_reduce('120km', 'mean')
233±0.2ms 233±0.1ms 1.00 mpas_ocean.NeighborhoodReduce.time_reduce('120km', 'median')
553±20μs 609±30μs ~1.10 mpas_ocean.NeighborhoodReduce.time_reduce('480km', 'mean')
1.95±0.01ms 2.07±0.05ms 1.06 mpas_ocean.NeighborhoodReduce.time_reduce('480km', 'median')
239k 239k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('120km', 'mean')
245k 245k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('120km', 'median')
19.4k 19.4k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('480km', 'mean')
19.9k 19.9k 1.00 mpas_ocean.NeighborhoodReduce.track_peakmem_reduce('480km', 'median')
385±10μs 416±8μs 1.08 mpas_ocean.PointInPolygon.time_face_search_lonlat('120km')
374±10μs 408±20μs 1.09 mpas_ocean.PointInPolygon.time_face_search_lonlat('480km')
379±20μs 379±10μs 1.00 mpas_ocean.PointInPolygon.time_face_search_xyz('120km')
370±10μs 378±10μs 1.02 mpas_ocean.PointInPolygon.time_face_search_xyz('480km')
228±0.8ms 235±2ms 1.03 mpas_ocean.RemapDownsample.time_bilinear_remapping
289±7ms 289±2ms 1.00 mpas_ocean.RemapDownsample.time_inverse_distance_weighted_remapping
15.7±0.05ms 16.0±0.2ms 1.02 mpas_ocean.RemapDownsample.time_nearest_neighbor_remapping
1.38±0.02s 1.37±0s 0.99 mpas_ocean.RemapUpsample.time_bilinear_remapping
36.8±0.4ms 37.6±0.4ms 1.02 mpas_ocean.RemapUpsample.time_inverse_distance_weighted_remapping
12.5±0.09ms 12.7±0.3ms 1.02 mpas_ocean.RemapUpsample.time_nearest_neighbor_remapping
9.79±0.1ms 10.0±0.06ms 1.03 mpas_ocean.ZonalAverage.time_zonal_average('120km')
5.63±0.1ms 5.70±0.07ms 1.01 mpas_ocean.ZonalAverage.time_zonal_average('480km')
358M 359M 1.00 mpas_ocean.ZonalAveragePeakMem.peakmem_zonal_average('120km')
344M 341M 0.99 mpas_ocean.ZonalAveragePeakMem.peakmem_zonal_average('480km')
6.84±0.05ms 6.88±0.08ms 1.01 quad_hexagon.QuadHexagon.time_open_dataset
5.71±0.04ms 5.84±0.06ms 1.02 quad_hexagon.QuadHexagon.time_open_grid
408 408 1.00 quad_hexagon.QuadHexagon.track_nbytes_open_dataset
392 392 1.00 quad_hexagon.QuadHexagon.track_nbytes_open_grid
73.4k 73.8k 1.01 quad_hexagon.QuadHexagon.track_peakmem_open_dataset
72.8k 73k 1.00 quad_hexagon.QuadHexagon.track_peakmem_open_grid

Benchmarks that have got worse:

Change Before [5e8021d] After [2baee7e] Ratio Benchmark (Parameter)
+ 77.2±0.5ms 89.4±2ms 1.16 bench_connectivity.Connectivity.time_node_face('120km')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-benchmark Run ASV benchmark workflow scalability Related to scalability & performance efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid tiny numpy arrays in numba: optimize intersections.py

1 participant