-
Notifications
You must be signed in to change notification settings - Fork 170
Change RSchedule to use maps instead of lists for lookups. #828
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
Conversation
|
Cool, sounds reasonable. Code looks fine, but I have one question. The expected Verilog changed in one example, and a signal name changed from All good, but I worry that the order may not be stable, and perhaps we care about that? There are two places where the map is flattened: one is for printing, where |
25574fc to
dd042a5
Compare
|
I tried just doing the sort in AState too and it didn't show up in my profile so I thought that was the easiest and cleanest fix. |
quark17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to merge this, but noticed one last question.
| colorBk _ cs es [] = return (cs,es) | ||
| colorBk rMaxL cs es (Vertex vns@(v,_) : vs) = | ||
| colorBk rMaxL ((v, pickColor rMaxL cs vns):cs) es vs | ||
| colorBk rMaxL (M.insert v (pickColor rMaxL cs vns) cs) es vs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This silently replaces an existing key. In keeping with your use of internal errors elsewhere, did you want to use an insert function reports an internal error when the key exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code more carefully, those keys come from the vertices of a GraphMap, which uses a map internally, so they can't conflict. That makes me think an internalError is redundant and not really worth it. Maybe it is worth a comment, but I don't feel strongly about that either way.
In fact, looking at rSchedule, the keys for the final map come from an M.toList rMap so they can't conflict either. Maybe we should take internalError out? Though, again, I don't feel strongly about it either way.
The case I do feel strongly enough about is the error in AAddSchedAssumps. I think we should keep that one because modifying an APackage like that dicey enough that we need every extra check.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly. I can go with whatever you want.
A comment wouldn't hurt. I assume there's no performance impact to using a function with an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up taking out the internalError for rSchedule and switching to a comment because I thought the code looked nicer and closer to what was there before.
Bad performance cases for this may not be common, but I have encountered one.
dd042a5 to
2bf8a5e
Compare
|
I made some tiny cleanups. If you have no objection, I'll squash merge it. Thank you! |
|
Good catches! Merge away. |
Bad performance cases for this may not be common, but I have encountered one.