-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add sim642/ppx_deriving_hash #542
Conversation
I ran it before vs after on sv-benchmarks ConcurrencySafety and SoftwareSystems and to my surprise, it even got ~5% faster: I haven't put any thought into optimizing ppx_deriving_hash, so I didn't expect this. If I were to guess, this improvement is just due to replacing some |
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.
LGTM! My only question is if we want to fork the ppx_deriver under our organization, such that all developers can potentially work on it?
I thought about that, but all the other ppx forks have been under personal accounts as well:
Given the obscurity of ppx deriver internals, I'm doubtful that anyone else would currently work on it anyway and deal with its publishing (which I'm planning on doing soon to get rid of the pin). If there's ever real need, then it's still possible to transfer or fork it under the organization. |
The package has been accepted to opam: ocaml/opam-repository#20555. Once it becomes available through the website, I will remove the pin, fix conflicts and do the merge. |
There's some very weird crash in incremental tests now:
It's somehow related to let hash = function
(* crashes *)
(* | Statement x0 -> (31 * 0) + (CilType.Stmt.hash x0) *)
(* does not crash *)
| Statement x0 -> 1 + (CilType.Stmt.hash x0)
| FunctionEntry x0 -> (31 * 1) + (CilType.Fundec.hash x0)
| Function x0 -> (31 * 2) + (CilType.Fundec.hash x0) Is |
It's also somehow related to |
The opam package is now published: https://opam.ocaml.org/packages/ppx_deriving_hash/. I've removed the opam pin and am merging this. |
Part of #31.
A while back I toyed around with ppx derivers and, as mentioned in the above issue, implemented https://github.com/sim642/ppx_deriving_hash to do
[@@deriving hash]
. This is simpler and without dependencies, unlike ppx_hash, which require's Jane Street's Base to work.This revealed #541, which has nothing to do with hashing. It's just that previously by sheer luck, the tuples with such different precisions had different hashes, thus they never fell into the same hashtable buckets to need
equal
comparison.Another open question is, what are the best hash functions to derive for primitives, products (tuples, records) and sums (variants). Our manual implementations include both
Hashtbl.hash
based things and arbitrary calculations with magic constants.TODO