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

quant_api.py throws away work #303

Closed
dabreegster opened this issue Jan 4, 2022 · 5 comments
Closed

quant_api.py throws away work #303

dabreegster opened this issue Jan 4, 2022 · 5 comments

Comments

@dabreegster
Copy link

I just got a many orders-of-magnitude speedup of the QUANT table lookups by removing some code that has no effect:
dabreegster@62798a5

Two questions...

  1. What is the URN lookup at

    row2 = dfPrimaryZones.loc[dfPrimaryZones['zonei'] == j] #yes, zonei==j is correct, they're always called 'zonei'
    supposed to do? Was this for debugging? We assign to id, but then never do anything with it, so it has no effect, except to massively slow down this routine or to throw a KeyError if something's missing (but I've never seen this happen)

  2. Why are there several copies of the same logic? The comments and naming are slightly different, but the method has already been refactored to take in different tables previously.

Thanks, and please forgive all the beginner questions!

@nickmalleson
Copy link
Collaborator

nickmalleson commented Jan 4, 2022 via email

@nickmalleson
Copy link
Collaborator

nickmalleson commented Jan 4, 2022 via email

@dabreegster
Copy link
Author

Thanks for the fast response! (I assume Richard is subscribed to the conversation here, or being forwarded emails?)

I think the URN is used earlier to set up activity locations, but there's no need to do this mapping in the middle of the QUANT table lookup. I would guess it was put in there originally for debugging, but never taken out, and has been slowing down that code for a while. :)

This gets used in the RAMP model to propagate the infection, but I don’t think the QUANT part ever gets used beyond the model initialisation stage?

That's correct based on my understanding so far. The init stage in Python can take many hours for larger regions, and one of the biggest slowdowns is here. But the speedups won't affect running the model.

One final question, but where can I find the code that Improbable wrote?

Who is Improbable? In case you meant the Rust port that I started, the QUANT code is at https://github.com/dabreegster/rampfs/blob/a5087204f484b21e5ff80246f98e8831bd67a4a5/src/quant.rs#L118.

@nickmalleson
Copy link
Collaborator

nickmalleson commented Jan 5, 2022 via email

@dabreegster
Copy link
Author

Cleaning up this old issue. If anybody using the main branch here needs to speed up their QUANT reader, just remove the dead code mentioned above

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