Skip to content

Commit

Permalink
Use DirtyCpu schedule for expensive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtaylor committed Mar 6, 2024
1 parent 8b79497 commit f84059b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions native/h3geo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn point_to_cell(point: Point, resolution: u8) -> Result<u64, Atom> {
return Ok(u64::from(cell));
}

#[rustler::nif]
#[rustler::nif(schedule = "DirtyCpu")]
fn polygon_to_cells(polygon: Polygon, resolution: u8) -> Result<Vec<u64>, Atom> {
let resolution = match h3o::Resolution::try_from(resolution) {
Ok(resolution) => resolution,
Expand All @@ -128,7 +128,7 @@ fn polygon_to_cells(polygon: Polygon, resolution: u8) -> Result<Vec<u64>, Atom>
return Ok(cells.map(|cell| u64::from(cell)).unique().collect());
}

#[rustler::nif]
#[rustler::nif(schedule = "DirtyCpu")]
fn multipolygon_to_cells(multipolygon: MultiPolygon, resolution: u8) -> Result<Vec<u64>, Atom> {
let resolution = match h3o::Resolution::try_from(resolution) {
Ok(resolution) => resolution,
Expand Down

0 comments on commit f84059b

Please sign in to comment.