-
-
Save yjh0502/377ea1998e74abcd40a38bf7e4eab73a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
_ "github.com/golang/geo/s1" | |
_ "github.com/golang/geo/r1" | |
"github.com/golang/geo/s2" | |
"fmt" | |
) | |
func main() { | |
coverer := s2.RegionCoverer { | |
MinLevel: 19, | |
MaxLevel: 19, | |
LevelMod: 0, | |
MaxCells: 1000000000, | |
}; | |
rect := s2.RectFromCenterSize( | |
s2.LatLngFromDegrees(-37.5, 144.5), | |
s2.LatLngFromDegrees(1.0, 1.0)) | |
covering := coverer.Covering(rect) | |
fmt.Printf("%d\n", len(covering)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ \time -v go run test.go | |
40024944 | |
Command being timed: "go run test.go" | |
User time (seconds): 42.62 | |
System time (seconds): 7.18 | |
Percent of CPU this job got: 162% | |
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:30.58 | |
Average shared text size (kbytes): 0 | |
Average unshared data size (kbytes): 0 | |
Average stack size (kbytes): 0 | |
Average total size (kbytes): 0 | |
Maximum resident set size (kbytes): 10285376 | |
Average resident set size (kbytes): 0 | |
Major (requiring I/O) page faults: 3 | |
Minor (reclaiming a frame) page faults: 2492757 | |
Voluntary context switches: 6398 | |
Involuntary context switches: 19360 | |
Swaps: 0 | |
File system inputs: 0 | |
File system outputs: 3080 | |
Socket messages sent: 0 | |
Socket messages received: 0 | |
Signals delivered: 0 | |
Page size (bytes): 4096 | |
Exit status: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let coverer = s2::region::RegionCoverer { | |
min_level: 19, | |
max_level: 19, | |
level_mod: 0, | |
max_cells: usize::MAX, | |
}; | |
let rect = s2::rect::Rect::from_center_size( | |
s2::latlng::LatLng::from_degrees(-37.5, 144.5), | |
s2::latlng::LatLng::from_degrees(1.0, 1.0), | |
); | |
let children_cells = coverer.covering(&rect).0; | |
println!("{}", children_cells.len()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cargo build --release && \time -v target/release/rust | |
Compiling rust v0.1.0 (/home/jihyun/ws/rust-s2/rust) | |
Finished release [optimized] target(s) in 0.29s | |
40040019 | |
Command being timed: "target/release/rust" | |
User time (seconds): 20.71 | |
System time (seconds): 1.33 | |
Percent of CPU this job got: 99% | |
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:22.07 | |
Average shared text size (kbytes): 0 | |
Average unshared data size (kbytes): 0 | |
Average stack size (kbytes): 0 | |
Average total size (kbytes): 0 | |
Maximum resident set size (kbytes): 4775596 | |
Average resident set size (kbytes): 0 | |
Major (requiring I/O) page faults: 0 | |
Minor (reclaiming a frame) page faults: 1193467 | |
Voluntary context switches: 1 | |
Involuntary context switches: 2173 | |
Swaps: 0 | |
File system inputs: 0 | |
File system outputs: 0 | |
Socket messages sent: 0 | |
Socket messages received: 0 | |
Signals delivered: 0 | |
Page size (bytes): 4096 | |
Exit status: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment