Skip to content

feat: track_periodic_value_change_counts! macro#917

Open
RobertJacobsonCDC wants to merge 1 commit into
mainfrom
RobertJacobsonCDC_855_incidence_syntax
Open

feat: track_periodic_value_change_counts! macro#917
RobertJacobsonCDC wants to merge 1 commit into
mainfrom
RobertJacobsonCDC_855_incidence_syntax

Conversation

@RobertJacobsonCDC
Copy link
Copy Markdown
Collaborator

Introduces a macro to simplify the syntax for calling context.track_periodic_value_change_counts(...).

Some example invocations:

track_periodic_value_change_counts!(
    context,
    Person,
    InfectionStatus,
    1.0,
    handle_incidence_tracking
);

track_periodic_value_change_counts!(
    context,
    Person,
    InfectionStatus,
    [Age],
    1.0,
    move |_context, counter| {
        let _ = counter;
    }
);

track_periodic_value_change_counts!(
    context,
    Person,
    InfectionStatus,
    [Age, HighRisk],
    1.0,
    handle_incidence_tracking
);

@github-actions
Copy link
Copy Markdown

Benchmark Results

Hyperfine

Command Mean [ms] Min [ms] Max [ms] Relative
large_sir::baseline 3.3 ± 0.0 3.2 3.4 1.00
large_sir::baseline_households 3.3 ± 0.1 3.2 3.5 1.01 ± 0.02
large_sir::entities 7.0 ± 0.1 6.9 7.7 2.14 ± 0.05
large_sir::households 6.8 ± 0.1 6.7 7.0 2.08 ± 0.04

Criterion

Regressions (slower)
Group Bench Param Change CI Lower CI Upper
sample_entity sample_entity_single_property_unindexed 10000 47.999% 44.830% 50.771%
sample_entity sample_entity_single_property_unindexed 1000 26.497% 24.448% 28.317%
sample_entity sample_entity_multi_property_indexed 1000 2.847% 2.639% 3.064%
sample_entity sample_entity_multi_property_indexed 10000 2.613% 2.341% 2.861%
sample_entity sample_entity_multi_property_indexed 100000 1.954% 1.730% 2.191%
counts multi_property_indexed_entities 1.901% 1.422% 2.502%
examples example-births-deaths 1.407% 1.038% 1.747%
Improvements (faster)
Group Bench Param Change CI Lower CI Upper
sample_entity sample_entity_whole_population 100000 -26.695% -27.175% -26.202%
sample_entity sample_entity_whole_population 1000 -25.505% -26.282% -24.722%
sample_entity sample_entity_whole_population 10000 -22.720% -24.073% -21.217%
counts single_property_unindexed_entities -22.640% -23.101% -22.139%
counts concrete_plus_derived_unindexed_entities -22.571% -22.885% -22.173%
large_dataset bench_query_population_derived_property_entities -9.347% -10.383% -8.295%
counts reindex_after_adding_more_entities -5.648% -5.975% -5.344%
indexing with_query_results_multiple_individually_indexed_properties_enti -2.098% -2.526% -1.687%
sampling sampling_multiple_l_reservoir_entities -1.815% -2.008% -1.636%
Unchanged / inconclusive (CI crosses 0%)
Group Bench Param Change CI Lower CI Upper
sample_entity sample_entity_single_property_indexed 100000 -1.604% -2.240% -0.909%
large_dataset bench_filter_indexed_entity -1.545% -8.717% 6.031%
large_dataset bench_match_entity 1.401% 0.773% 1.939%
sampling sampling_multiple_known_length_entities -1.384% -1.922% -0.825%
counts index_after_adding_entities 1.234% 0.990% 1.489%
algorithm_benches algorithm_sampling_multiple_known_length 1.135% 0.035% 2.283%
sampling sampling_single_unindexed_concrete_plus_derived_entities 1.074% 0.874% 1.294%
indexing query_people_count_indexed_multi-property_entities 1.043% 0.711% 1.362%
counts multi_property_unindexed_entities -0.957% -2.452% 0.264%
indexing query_people_indexed_multi-property_entities -0.883% -1.573% -0.269%
sample_entity sample_entity_single_property_indexed 10000 -0.880% -1.357% -0.462%
examples example-basic-infection -0.806% -1.602% -0.071%
large_dataset bench_query_population_indexed_property_entities 0.711% -0.126% 1.496%
indexing query_people_multiple_individually_indexed_properties_entities 0.619% 0.434% 0.788%
sample_entity sample_entity_single_property_indexed 1000 0.600% 0.078% 1.093%
sampling count_and_sampling_single_unindexed_concrete_plus_derived_entiti 0.512% 0.340% 0.664%
algorithm_benches algorithm_sampling_single_rand_reservoir -0.493% -0.957% -0.151%
sampling sampling_single_l_reservoir_entities -0.469% -0.720% -0.216%
sample_entity sample_entity_single_property_unindexed 100000 0.458% 0.165% 0.722%
indexing with_query_results_indexed_multi-property_entities 0.349% -0.131% 0.879%
large_dataset bench_query_population_multi_indexed_entities 0.342% -0.158% 0.669%
large_dataset bench_filter_unindexed_entity 0.341% -4.563% 5.864%
sampling count_and_sampling_single_known_length_entities -0.331% -0.991% 0.330%
indexing query_people_single_indexed_property_entities 0.290% 0.068% 0.616%
indexing query_people_count_multiple_individually_indexed_properties_enti -0.286% -1.100% 0.418%
large_dataset bench_query_population_property_entities -0.239% -0.966% 0.473%
algorithm_benches algorithm_sampling_multiple_l_reservoir -0.238% -0.628% 0.192%
sampling sampling_multiple_unindexed_entities 0.212% -0.052% 0.598%
sampling sampling_single_known_length_entities -0.208% -0.861% 0.434%
counts single_property_indexed_entities -0.191% -0.602% 0.091%
indexing with_query_results_single_indexed_property_entities -0.128% -0.598% 0.284%
algorithm_benches algorithm_sampling_single_known_length -0.121% -0.369% 0.108%
large_dataset bench_query_population_multi_unindexed_entities 0.084% -0.440% 0.445%
sampling sampling_single_unindexed_entities 0.083% -0.201% 0.408%
indexing query_people_count_single_indexed_property_entities 0.077% -0.291% 0.575%
algorithm_benches algorithm_sampling_single_l_reservoir -0.053% -0.214% 0.107%
Not Compared (no baseline yet)
Group Bench Reason
(none)

github-actions Bot added a commit that referenced this pull request May 22, 2026
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.

Brainstorm syntax, implementation for track_periodic_value_change_counts

1 participant