-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Fixed format for 'dbg' #6241
Fixed format for 'dbg' #6241
Conversation
Signed-off-by: Richard Feldman <[email protected]>
Signed-off-by: Rod <[email protected]>
Signed-off-by: Henrikh Kantuni <[email protected]>
Signed-off-by: Vladimir Zotov <[email protected]>
ankerl::dense_unordered is a very fast hash map that is built to be an index map. This enables extra optimizations compared to just wrapping a regular hash map. As such, I think this map is very well suited for our index map impl in Roc. I also think this dictionary implementation is simpler overall. On top of that, this removes the need for SIMD instructions for peak performance. Benchmarks of the C++ version and other C++ hash maps are here: https://martin.ankerl.com/2022/08/27/hashmap-bench-01/ Though this has clear bias of being written by the author of ankerl::dense_unordered, the results all look correct and the benchmarks thorough.
I think for now it is not worth considering adding hashflooding mitigation to the Roc Dict. 1. Wyhash is a secure enough has to pass SMHasher. 2. Languages like Go use wyhash in production and have not seen hashflooding issues. 3. We do have a random seed that Dicts use that changes per application linking. (Could monomorphize on Dict type for more randomness) 4. Any sort of fallback checks will lead to worse performance in the normal case. 5. A reasonable http server or app can limit the size of JSON or number of HTTP headers to accept.
Signed-off-by: Vladimir Zotov <[email protected]>
3c20e13
to
58b73ae
Compare
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.
Looks good to me overall, is there a single line test case? Maybe one already existed so you didn't have to add a new one?
Yes, there already has been a single line snapshost test, but because of the existence of "crates/compiler/test_syntax/tests/snapshots/pass/dbg.expr.formatted.roc" it was configured so that expanding the 'dbg' into multiple lines was considered correct. That is why I deleted that file. |
I've fixed the unconditional addition of new line after the 'dbg' keyword (issue #6188), and implemented the suggested way of formatting the 'dbg' with multi line condition.