Copilot commented on code in PR #600:
URL: https://github.com/apache/sedona-db/pull/600#discussion_r2794568721


##########
rust/sedona-raster-functions/benches/rs_envelope.rs:
##########
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+use criterion::{criterion_group, criterion_main, Criterion};
+use sedona_testing::benchmark_util::{benchmark, BenchmarkArgSpec::*};
+
+fn criterion_benchmark(c: &mut Criterion) {
+    let f = sedona_raster_functions::register::default_function_set();
+
+    // RS_Envelope(raster)
+    benchmark::scalar(c, &f, "rs_envelope", "rs_envelope", Raster(64, 64));
+    benchmark::scalar(c, &f, "rs_envelope", "rs_envelope", Raster(256, 256));
+    benchmark::scalar(c, &f, "rs_envelope", "rs_envelope", Raster(1024, 1024));

Review Comment:
   All three benchmark registrations share the same group and function name 
strings, which can make Criterion output hard to interpret and (depending on 
how `benchmark::scalar` names benchmarks) can risk non-unique benchmark IDs. 
Consider incorporating the raster size into the benchmark ID (or group name) 
explicitly, and/or looping over a `[(64,64), (256,256), (1024,1024)]` list to 
avoid repeated calls.
   ```suggestion
       // RS_Envelope(raster) for various raster sizes
       for &(width, height) in &[(64, 64), (256, 256), (1024, 1024)] {
           let group_name = format!("rs_envelope_{}x{}", width, height);
           benchmark::scalar(c, &f, &group_name, "rs_envelope", Raster(width, 
height));
       }
   ```



##########
rust/sedona-raster-functions/benches/rs_size.rs:
##########
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+use criterion::{criterion_group, criterion_main, Criterion};
+use sedona_testing::benchmark_util::{benchmark, BenchmarkArgSpec::*};
+
+fn criterion_benchmark(c: &mut Criterion) {
+    let f = sedona_raster_functions::register::default_function_set();
+
+    // RS_Width(raster)
+    benchmark::scalar(c, &f, "rs_size", "rs_width", Raster(64, 64));
+    benchmark::scalar(c, &f, "rs_size", "rs_width", Raster(256, 256));
+    benchmark::scalar(c, &f, "rs_size", "rs_width", Raster(1024, 1024));
+
+    // RS_Height(raster)
+    benchmark::scalar(c, &f, "rs_size", "rs_height", Raster(64, 64));
+    benchmark::scalar(c, &f, "rs_size", "rs_height", Raster(256, 256));
+    benchmark::scalar(c, &f, "rs_size", "rs_height", Raster(1024, 1024));

Review Comment:
   This repeats the same benchmark registration pattern for multiple raster 
sizes and for both width/height. To reduce duplication and make benchmark 
reports clearer, consider iterating over a shared list of sizes and ensuring 
the benchmark ID includes the size (so the three `rs_width` and three 
`rs_height` runs are clearly distinguishable in Criterion output).
   ```suggestion
       let sizes = [(64, 64), (256, 256), (1024, 1024)];
   
       for (width, height) in sizes {
           let bench_id = format!("rs_size_{}x{}", width, height);
   
           // RS_Width(raster)
           benchmark::scalar(c, &f, &bench_id, "rs_width", Raster(width, 
height));
   
           // RS_Height(raster)
           benchmark::scalar(c, &f, &bench_id, "rs_height", Raster(width, 
height));
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to