Skip to content

fix: Eagerly compute property value count indexes#1007

Open
RobertJacobsonCDC wants to merge 1 commit into
mainfrom
RobertJacobsonCDC_1006_fix_index_property_counts
Open

fix: Eagerly compute property value count indexes#1007
RobertJacobsonCDC wants to merge 1 commit into
mainfrom
RobertJacobsonCDC_1006_fix_index_property_counts

Conversation

@RobertJacobsonCDC

Copy link
Copy Markdown
Collaborator

Fixes a correctness bug and adds regression tests for an issue with value count indexes. Apparently we failed to initialize the index upon creation. Consequently, it's possible for a value count index to incorrectly count the number of entities with particular values.

The first is simple: just compute the index when it is created.

@RobertJacobsonCDC RobertJacobsonCDC linked an issue Jul 13, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown

Benchmark Results

Hyperfine

Command Mean [ms] Min [ms] Max [ms] Relative
large_sir::baseline 3.2 ± 0.0 3.2 3.4 1.00
large_sir::baseline_households 3.2 ± 0.0 3.2 3.4 1.00 ± 0.02
large_sir::entities 7.6 ± 0.4 7.4 10.0 2.36 ± 0.14
large_sir::households 7.3 ± 0.1 7.2 7.7 2.26 ± 0.04

Criterion

Regressions (slower)
Group Bench Param Change CI Lower CI Upper
indexing with_query_results_indexed_multi-property_entities 7.948% 7.208% 8.581%
sample_entity sample_entity_single_property_unindexed 10000 6.205% 2.598% 9.861%
sample_entity sample_entity_single_property_indexed 10000 5.078% 4.553% 5.641%
sample_entity sample_entity_single_property_indexed 100000 2.999% 2.405% 3.493%
counts index_after_adding_entities 2.639% 1.574% 3.659%
examples example-births-deaths 2.256% 1.955% 2.587%
large_dataset bench_query_population_multi_unindexed_entities 2.050% 1.420% 2.648%
sample_entity sample_entity_single_property_indexed 1000 1.997% 1.320% 2.700%
Improvements (faster)
Group Bench Param Change CI Lower CI Upper
sample_entity sample_entity_multi_property_indexed 10000 -14.943% -15.509% -14.371%
sample_entity sample_entity_multi_property_indexed 1000 -14.665% -15.231% -14.088%
sample_entity sample_entity_multi_property_indexed 100000 -13.141% -13.451% -12.804%
indexing query_people_single_indexed_property_entities -8.755% -8.977% -8.476%
large_dataset bench_query_population_multi_indexed_entities -7.177% -8.715% -5.559%
counts concrete_plus_derived_unindexed_entities -6.094% -7.143% -5.074%
counts single_property_unindexed_entities -3.404% -4.855% -1.855%
large_dataset bench_match_entity -3.169% -3.752% -2.715%
sample_entity sample_entity_whole_population 100000 -2.789% -3.688% -1.944%
sample_entity sample_entity_whole_population 1000 -2.268% -3.327% -1.255%
sampling sampling_single_l_reservoir_entities -2.222% -3.062% -1.506%
indexing query_people_count_multiple_individually_indexed_properties_enti -2.118% -2.245% -1.967%
counts single_property_indexed_entities -2.005% -2.817% -1.173%
sample_entity sample_entity_whole_population 10000 -1.934% -2.792% -1.089%
Unchanged / inconclusive (CI crosses 0%)
Group Bench Param Change CI Lower CI Upper
large_dataset bench_filter_unindexed_entity 2.018% -0.886% 5.145%
indexing with_query_results_single_indexed_property_entities 1.963% 0.408% 3.575%
sampling count_and_sampling_single_known_length_entities -1.468% -2.650% -0.248%
sampling sampling_single_known_length_entities -1.388% -2.754% 0.066%
counts multi_property_indexed_entities -1.321% -2.097% -0.550%
counts multi_property_unindexed_entities -1.175% -2.163% -0.227%
sample_entity sample_entity_single_property_unindexed 1000 -0.996% -4.400% 2.548%
examples example-basic-infection 0.894% 0.332% 1.438%
large_dataset bench_query_population_derived_property_entities -0.889% -1.877% -0.010%
sampling count_and_sampling_single_unindexed_concrete_plus_derived_entiti 0.795% 0.655% 0.930%
sampling sampling_multiple_l_reservoir_entities 0.601% 0.481% 0.705%
indexing query_people_count_indexed_multi-property_entities -0.522% -0.917% -0.261%
algorithm_benches algorithm_sampling_single_known_length 0.506% -1.091% 2.171%
sampling sampling_multiple_unindexed_entities 0.479% 0.260% 0.646%
sampling sampling_multiple_known_length_entities -0.416% -0.899% 0.063%
indexing with_query_results_multiple_individually_indexed_properties_enti -0.379% -0.999% 0.195%
algorithm_benches algorithm_sampling_multiple_l_reservoir 0.354% -0.051% 0.778%
large_dataset bench_query_population_property_entities -0.334% -0.930% 0.080%
counts reindex_after_adding_more_entities -0.289% -1.294% 0.536%
indexing query_people_multiple_individually_indexed_properties_entities -0.263% -0.551% 0.006%
indexing query_people_indexed_multi-property_entities -0.242% -0.466% 0.003%
sampling sampling_single_unindexed_concrete_plus_derived_entities 0.228% 0.158% 0.300%
algorithm_benches algorithm_sampling_multiple_known_length -0.208% -0.692% 0.191%
algorithm_benches algorithm_sampling_single_l_reservoir -0.194% -0.752% 0.228%
large_dataset bench_query_population_indexed_property_entities -0.054% -0.554% 0.320%
large_dataset bench_filter_indexed_entity -0.044% -1.805% 1.680%
sampling sampling_single_unindexed_entities 0.020% -0.049% 0.131%
algorithm_benches algorithm_sampling_single_rand_reservoir 0.020% -0.129% 0.191%
indexing query_people_count_single_indexed_property_entities -0.011% -0.715% 0.665%
sample_entity sample_entity_single_property_unindexed 100000 0.005% -0.282% 0.297%
Not Compared (no baseline yet)
Group Bench Reason
(none)

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

index_property_counts can double-count changed entities

1 participant