Skip to content

Comments

chore: add hash to entity macro derives#783

Open
cdc-as81 wants to merge 2 commits intomainfrom
cdc-as81-add-hash
Open

chore: add hash to entity macro derives#783
cdc-as81 wants to merge 2 commits intomainfrom
cdc-as81-add-hash

Conversation

@cdc-as81
Copy link
Collaborator

No description provided.

github-actions bot added a commit that referenced this pull request Feb 18, 2026
@github-actions
Copy link

Benchmark Results

Hyperfine

Command Mean [ms] Min [ms] Max [ms] Relative
large_sir::baseline 3.1 ± 0.2 2.9 4.0 1.00
large_sir::entities 13.1 ± 1.1 12.4 19.9 4.28 ± 0.43

Criterion

Regressions:
  Group                                    Bench                                              Change  CI Lower  CI Upper
  ---------------------------------------  ------------------------------------------------  -------  --------  --------
  sample_entity_single_property_unindexed  10000                                             16.333%   13.433%   19.135%
  sample_entity_single_property_unindexed  100000                                             2.117%    1.771%    2.430%
  large_dataset                            bench_query_population_multi_indexed_entities     10.065%    9.778%   10.354%
  large_dataset                            bench_query_population_derived_property_entities   1.921%    1.570%    2.161%
  sampling                                 sampling_multiple_known_length_entities            1.009%    0.679%    1.279%

Improvements:
  Group                                    Bench                                              Change  CI Lower  CI Upper
  ---------------------------------------  ------------------------------------------------  -------  --------  --------
  sample_entity_single_property_indexed    10000                                             -0.795%   -1.230%   -0.475%
  sample_entity_single_property_unindexed  1000                                              -1.188%   -1.630%   -0.888%
  large_dataset                            bench_filter_unindexed_entity                     -7.473%  -12.243%   -2.528%
  sampling                                 sampling_multiple_unindexed_entities              -0.096%   -0.179%   -0.027%
  sampling                                 sampling_multiple_l_reservoir_entities            -1.976%   -2.564%   -1.304%
  sampling                                 sampling_single_l_reservoir_entities              -1.397%   -1.538%   -1.255%
  sampling                                 sampling_single_known_length_entities             -2.201%   -2.566%   -1.831%
  sample_entity_whole_population           10000                                             -1.546%   -2.043%   -1.100%
  sample_entity_whole_population           100000                                            -2.360%   -2.668%   -1.901%
  sample_entity_whole_population           1000                                              -2.372%   -2.743%   -2.012%

Unchanged:
  Group                                    Bench                                              Change  CI Lower  CI Upper
  ---------------------------------------  ------------------------------------------------  -------  --------  --------
  sample_entity_single_property_indexed    100000                                            -0.053%   -0.471%    0.533%
  sample_entity_single_property_indexed    1000                                              -0.319%   -0.914%    0.244%
  sample_entity_multi_property_indexed     10000                                              0.486%   -0.092%    1.084%
  sample_entity_multi_property_indexed     100000                                             0.210%   -0.275%    0.797%
  sample_entity_multi_property_indexed     1000                                               0.247%   -0.015%    0.460%
  large_dataset                            bench_filter_indexed_entity                       -8.329%  -19.953%    5.113%
  large_dataset                            bench_query_population_property_entities          -0.008%   -0.265%    0.240%
  large_dataset                            bench_match_entity                                -0.059%   -0.501%    0.259%
  large_dataset                            bench_query_population_multi_unindexed_entities   -0.203%   -0.587%    0.334%
  large_dataset                            bench_query_population_indexed_property_entities   0.291%   -0.038%    0.785%
  sampling                                 sampling_single_unindexed_entities                -0.210%   -0.527%    0.021%

@cdc-as81 cdc-as81 linked an issue Feb 19, 2026 that may be closed by this pull request
@RobertJacobsonCDC
Copy link
Collaborator

I remember now that the reason we didn't automatically derive Hash on Property<Entity> is because f64 does not implement Hash, and so something like this gives a compiler error:

 define_property!(struct Weight(f64), Person, default_const = Weight(0.0));

I think we should look for a way around this before committing this PR. I also have some notes about this on the wiki.

If we can't provide a blanket implementation of Hash for Property<E> using the implementation of hash_property_value, say, then we should generate an implementation in define_property!.

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.

Add hash to list of entity macro derives

2 participants