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

Fixed format for 'dbg' #6241

Merged
merged 28 commits into from
Dec 11, 2023

Conversation

piotr-3-janiszewski
Copy link
Contributor

@piotr-3-janiszewski piotr-3-janiszewski commented Dec 10, 2023

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.

@piotr-3-janiszewski piotr-3-janiszewski changed the title Fixed format for 'dbg' Fixed format for 'dbg' #6188 Dec 10, 2023
@piotr-3-janiszewski piotr-3-janiszewski changed the title Fixed format for 'dbg' #6188 Fixed format for 'dbg' Dec 10, 2023
Signed-off-by: Richard Feldman <[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.
@piotr-3-janiszewski piotr-3-janiszewski marked this pull request as ready for review December 10, 2023 19:02
Copy link
Contributor

@bhansconnect bhansconnect left a 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?

@bhansconnect bhansconnect merged commit 49fb5a6 into roc-lang:main Dec 11, 2023
17 checks passed
@piotr-3-janiszewski
Copy link
Contributor Author

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.

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

Successfully merging this pull request may close these issues.

9 participants