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

ab_json() is slow #40

Open
Robinlovelace opened this issue Aug 9, 2021 · 4 comments
Open

ab_json() is slow #40

Robinlovelace opened this issue Aug 9, 2021 · 4 comments
Assignees

Comments

@Robinlovelace
Copy link
Collaborator

No description provided.

@Robinlovelace
Copy link
Collaborator Author

Robinlovelace commented Aug 9, 2021

Not totally reproducible example showing the example in the README takes ~30s on a decent computer, 10 times slower than creating the sf object. That is way too slow. Not sure exactly how best to speed this up but sure it's possible. In the meantime I suggest using only a sample of the OD data in the readme to create a minimal example.

> system.time({output_sf = ab_scenario(
+     od = montlake_od,
+     zones = montlake_zones,
+     zones_d = NULL,
+     origin_buildings = montlake_buildings,
+     destination_buildings = montlake_buildings,
+     pop_var = 3,
+     time_fun = ab_time_normal,
+     output = "sf",
+     modes = c("Walk", "Bike", "Drive", "Transit")
+ )})
0 origins with no match in zone ids
0 destinations with no match in zone ids
 points not in od data removed.
   user  system elapsed 
  2.369   0.024   2.418 
Warning messages:
1: In st_centroid.sf(origin_buildings) :
  st_centroid assumes attributes are constant over geometries of x
2: In st_centroid.sf(destination_buildings) :
  st_centroid assumes attributes are constant over geometries of x
> system.time({output_json = ab_json(output_sf, time_fun = ab_time_normal, scenario_name = "Montlake Example")
+ })
   user  system elapsed 
 28.435   0.149  28.607 

@Robinlovelace Robinlovelace self-assigned this Sep 5, 2021
@natesheehan
Copy link
Collaborator

@Robinlovelace are you still wanting to look at this? Right now don't think it's too much of a pressing issue?

@Robinlovelace
Copy link
Collaborator Author

Not much of a pressing issue, agreed. Yes still want to look at it, I guess there are good ways to speed it up so worth keeping open but not on the immediate todo list...

@natesheehan
Copy link
Collaborator

adding this here for rust helping us speed things up

https:/dabreegster/odjitter
https:/robinlovelace/georustr

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