Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ set(LIB_SOURCE_FILES
src/h3lib/lib/localij.c
src/h3lib/lib/latLng.c
src/h3lib/lib/directedEdge.c
src/h3lib/lib/iterGosper.c
src/h3lib/lib/mathExtensions.c
src/h3lib/lib/iterators.c
src/h3lib/lib/vertexGraph.c
Expand Down Expand Up @@ -286,6 +287,7 @@ set(OTHER_SOURCE_FILES
src/apps/testapps/testH3IteratorsInternal.c
src/apps/testapps/testMathExtensionsInternal.c
src/apps/testapps/testDescribeH3Error.c
src/apps/testapps/testGosperIter.c
src/apps/testapps/testGeoLoopArea.c
src/apps/miscapps/cellToBoundaryHier.c
src/apps/miscapps/cellToLatLngHier.c
Expand Down Expand Up @@ -325,6 +327,7 @@ set(OTHER_SOURCE_FILES
src/apps/benchmarks/benchmarkGridDiskCells.c
src/apps/benchmarks/benchmarkGridPathCells.c
src/apps/benchmarks/benchmarkDirectedEdge.c
src/apps/benchmarks/benchmarkGosperIter.c
src/apps/benchmarks/benchmarkVertex.c
src/apps/benchmarks/benchmarkIsValidCell.c
src/apps/benchmarks/benchmarkH3Api.c
Expand Down Expand Up @@ -674,6 +677,8 @@ if(BUILD_BENCHMARKS)
src/apps/benchmarks/benchmarkGridPathCells.c)
add_h3_benchmark(benchmarkDirectedEdge
src/apps/benchmarks/benchmarkDirectedEdge.c)
add_h3_benchmark(benchmarkGosperIter
src/apps/benchmarks/benchmarkGosperIter.c)
add_h3_benchmark(benchmarkVertex src/apps/benchmarks/benchmarkVertex.c)
add_h3_benchmark(benchmarkIsValidCell
src/apps/benchmarks/benchmarkIsValidCell.c)
Expand Down
1 change: 1 addition & 0 deletions CMakeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ add_h3_test(testH3IteratorsInternal src/apps/testapps/testH3IteratorsInternal.c)
add_h3_test(testMathExtensionsInternal
src/apps/testapps/testMathExtensionsInternal.c)
add_h3_test(testDescribeH3Error src/apps/testapps/testDescribeH3Error.c)
add_h3_test(testGosperIter src/apps/testapps/testGosperIter.c)
add_h3_test(testGeoLoopArea src/apps/testapps/testGeoLoopArea.c)

add_h3_test_with_arg(testH3NeighborRotations
Expand Down
53 changes: 53 additions & 0 deletions src/apps/benchmarks/benchmarkGosperIter.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2026 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "benchmark.h"
#include "iterators.h"

H3Index hex2 = 0x820887fffffffff; // res 2 hexagon
H3Index pent2 = 0x820807fffffffff; // res 2 pentagon

void exhaustGosper(H3Index cell, int childRes) {
IterEdgesGosper iter = iterInitGosper(cell, childRes);
while (iter.e) iterStepGosper(&iter);
}

BEGIN_BENCHMARKS();

// res: 2 -> 2
BENCHMARK(hex_plus0, 50000000, { exhaustGosper(hex2, 2); });
BENCHMARK(pent_plus0, 50000000, { exhaustGosper(pent2, 2); });

// res: 2 -> 3
BENCHMARK(hex_plus1, 500000, { exhaustGosper(hex2, 3); });
BENCHMARK(pent_plus1, 500000, { exhaustGosper(pent2, 3); });

// res: 2 -> 4
BENCHMARK(hex_plus2, 100000, { exhaustGosper(hex2, 4); });
BENCHMARK(pent_plus2, 100000, { exhaustGosper(pent2, 4); });

// res: 2 -> 7
BENCHMARK(hex_plus5, 1000, { exhaustGosper(hex2, 7); });
BENCHMARK(pent_plus5, 1000, { exhaustGosper(pent2, 7); });

// res: 2 -> 10
BENCHMARK(hex_plus8, 100, { exhaustGosper(hex2, 10); });
BENCHMARK(pent_plus8, 100, { exhaustGosper(pent2, 10); });

// res: 2 -> 13
BENCHMARK(hex_plus11, 10, { exhaustGosper(hex2, 13); });
BENCHMARK(pent_plus11, 10, { exhaustGosper(pent2, 13); });

END_BENCHMARKS();
Loading
Loading