Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large Memory Consumption on Region Covering #42

Open
KarlRunge opened this issue May 6, 2024 · 1 comment
Open

Large Memory Consumption on Region Covering #42

KarlRunge opened this issue May 6, 2024 · 1 comment

Comments

@KarlRunge
Copy link

KarlRunge commented May 6, 2024

While trying to cover a region of lat lon (Lat: -37 -> -38, Lon: 147 -> 148), While getting all the CellIds in that region. The function call seems to use approx 2.5gb of RAM, which what should be approx 200mb.

Reproduction code:

let coverer = s2::region::RegionCoverer {
    min_level: 19,
    max_level: 19,
    level_mod: 0,
    max_cells: usize::MAX,
};

let rect = s2::rect::Rect::from_degrees(
    -38.0,
    144.0,
    -37.0,
    145.0,
);
let children_cells = coverer.covering(&rect).0;
@yjh0502
Copy link
Owner

yjh0502 commented May 13, 2024

I tried to reproduce the result by myself. Here's code snippet that I used to reproduce: https://gist.github.com/yjh0502/377ea1998e74abcd40a38bf7e4eab73a

  • # of cells does not match (probably a bug?), but in similar scale (go 40024944 / rust 40040019)
  • wall clock times are comparable (go 0:30.58 / rust 0:22.07) and max RSSs are also in comparable range (go 10285MB / rust 4775MB)

I believe 200mb comes from memory usage to store output ((8b * 40040019) / (2**20) ~= 305mb). It seems covering requires more memory for calculation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants