Skip to content

Represent frozen summaries as arrays rather than maps. - #22970

Draft
ppedrot wants to merge 1 commit into
rocq-prover:masterfrom
ppedrot:flat-frozen-summaries
Draft

ppedrot wants to merge 1 commit into
rocq-prover:masterfrom
ppedrot:flat-frozen-summaries

Conversation

@ppedrot

@ppedrot ppedrot commented Dec 4, 2026

Copy link
Copy Markdown
Member

Freezing used to rebuild a map over all the registered summaries at every freeze, which happens several times per command. We now cache a tag-sorted array view of the declarations, and frozen states are a value array sharing the tag array of that view.

Note that a Not_found exception raised by an unfreeze function is not caught anymore to be turned into a summary reinitialization.

Freezing used to rebuild a map over all the registered summaries at
every freeze, which happens several times per command. We now cache a
tag-sorted array view of the declarations, and frozen states are a value
array sharing the tag array of that view.

Note that a Not_found exception raised by an unfreeze function is not
caught anymore to be turned into a summary reinitialization.
@ppedrot ppedrot added request: full CI Use this label when you want your next push to trigger a full CI. kind: experiment labels Dec 4, 2026
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Dec 4, 2026
@ppedrot

ppedrot commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

@coqbot bench

@coqbot-app

coqbot-app Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

🏁 Bench results:

┌─────────────────────────────────────┬─────────────────────────┬───────────────────────────────────────┬──────────────────────────┐
│                                     │      user time [s]      │           CPU instructions            │  max resident mem [KB]   │
│                                     │                         │                                       │                          │
│            package_name             │   NEW      OLD    PDIFF │      NEW             OLD        PDIFF │   NEW      OLD    PDIFF  │
├─────────────────────────────────────┼─────────────────────────┼───────────────────────────────────────┼──────────────────────────┤
│                         coq-ext-lib │   12.25    12.54  -2.31 │    79825823260     79913768334  -0.11 │  424944   426340   -0.33 │
│          rocq-mathcomp-finite-group │   20.71    21.09  -1.80 │   125161487978    125703375424  -0.43 │  632848   637592   -0.74 │
│                rocq-mathcomp-finmap │    9.56     9.72  -1.65 │    58264102470     58562798959  -0.51 │  569876   580056   -1.76 │
│             rocq-mathcomp-ssreflect │    1.20     1.22  -1.64 │     7465185474      7463990429   0.02 │  664140   664076    0.01 │
│                          rocq-stdpp │   64.35    65.33  -1.50 │   367408123525    368876250013  -0.40 │  755856   773764   -2.31 │
│                 rocq-mathcomp-order │   92.84    94.04  -1.28 │   603315516389    604010064348  -0.11 │  961616   973924   -1.26 │
│                  rocq-mathcomp-boot │   38.22    38.69  -1.21 │   211347944320    212539584146  -0.56 │  693100   689968    0.45 │
│                        coq-coqprime │   58.15    58.78  -1.07 │   383235209936    384948566783  -0.45 │  817344   915136  -10.69 │
│                           coq-color │  222.25   224.43  -0.97 │  1360131122507   1363275138603  -0.23 │ 1276780  1274500    0.18 │
│                      coq-coquelicot │   37.95    38.31  -0.94 │   219221786004    220163630852  -0.43 │  689312   697220   -1.13 │
│               rocq-mathcomp-algebra │  313.30   316.25  -0.93 │  2082563842312   2084625576014  -0.10 │ 1431440  1426764    0.33 │
│                            coq-hott │  161.77   163.29  -0.93 │  1020670367241   1022634869700  -0.19 │  487524   488480   -0.20 │
│                         rocq-stdlib │  240.16   242.40  -0.92 │  1458098209627   1462431352155  -0.30 │  808116   807856    0.03 │
│                 rocq-mathcomp-field │  159.70   161.07  -0.85 │  1069379899990   1070276706469  -0.08 │ 2650776  2644356    0.24 │
│                 rocq-iris-heap-lang │   74.93    75.53  -0.79 │   450195792335    450394577587  -0.04 │  836028   835348    0.08 │
│                         coq-coqutil │   44.25    44.58  -0.74 │   267813785716    268171205734  -0.13 │  516088   522552   -1.24 │
│                        rocq-bignums │   21.86    22.02  -0.73 │   136219579465    136502238774  -0.21 │  510932   510812    0.02 │
│                            coq-corn │  550.28   554.24  -0.71 │  3588127981245   3591939554745  -0.11 │  746092   751040   -0.66 │
│         coq-rewriter-perf-SuperFast │  371.52   374.12  -0.69 │  2855113714438   2855264790493  -0.01 │ 2064292  2063504    0.04 │
│ coq-neural-net-interp-computed-lite │  246.12   247.72  -0.65 │  2324232053105   2324494531954  -0.01 │  947032   947584   -0.06 │
│                 rocq-metarocq-utils │   19.27    19.39  -0.62 │   123197963192    122919828493   0.23 │  614608   624888   -1.65 │
│                         coq-unimath │ 1580.20  1589.22  -0.57 │ 13339604814354  13348754851256  -0.07 │ 1921252  1920972    0.01 │
│                 coq-category-theory │ 1251.40  1258.34  -0.55 │  8734359989175   8742736683810  -0.10 │ 1238776  1239196   -0.03 │
│              rocq-mathcomp-solvable │   67.39    67.71  -0.47 │   420474116143    421129700758  -0.16 │ 1006496  1010684   -0.41 │
│                  rocq-iris-examples │  337.55   339.04  -0.44 │  2085162509996   2085455476112  -0.01 │ 1173288  1173588   -0.03 │
│                    coq-fiat-parsers │  269.72   270.90  -0.44 │  2030659016090   2031859441648  -0.06 │ 2293268  2291488    0.08 │
│                       coq-fiat-core │   64.05    64.33  -0.44 │   400635208487    401145101223  -0.13 │  534072   537876   -0.71 │
│              rocq-mathcomp-analysis │ 1147.88  1152.01  -0.36 │  7862955617763   7865526800442  -0.03 │ 2385888  2389180   -0.14 │
│  rocq-mathcomp-group-representation │   73.77    74.02  -0.34 │   475974019643    476439884375  -0.10 │ 1532364  1528640    0.24 │
│             rocq-mathcomp-classical │   89.03    89.30  -0.30 │   558307442277    558546086949  -0.04 │ 1771488  1786416   -0.84 │
│          coq-performance-tests-lite │  745.28   747.40  -0.28 │  5907363628849   5904262512472   0.05 │ 1713628  1796636   -4.62 │
│                       coq-fourcolor │ 1335.19  1338.09  -0.22 │ 12066843427854  12067687237719  -0.01 │ 1082656  1083812   -0.11 │
│                        coq-bedrock2 │  244.98   245.48  -0.20 │  1819802221683   1820466489182  -0.04 │  936800   937016   -0.02 │
│                rocq-metarocq-common │  124.93   125.16  -0.18 │   777475497455    775586036607   0.24 │ 2386600  2268272    5.22 │
│                        coq-rewriter │  288.29   288.81  -0.18 │  2087405492009   2088049301566  -0.03 │ 1529168  1526704    0.16 │
│        coq-fiat-crypto-with-bedrock │ 6536.18  6547.03  -0.17 │ 52688105899348  52690371369531  -0.00 │ 5209364  5209392   -0.00 │
│                           rocq-core │   11.37    11.38  -0.09 │    73601577881     73820692832  -0.30 │  450992   451308   -0.07 │
│                        rocq-runtime │  274.28   274.50  -0.08 │  2011045937695   2010503615105   0.03 │  596148   594936    0.20 │
│               coq-engine-bench-lite │  114.21   114.28  -0.06 │   879587604201    879307752866   0.03 │ 1049884  1049664    0.02 │
│               rocq-metarocq-erasure │  726.75   727.15  -0.06 │  4572047807012   4560812864299   0.25 │ 2443156  2408892    1.42 │
│                           rocq-iris │  289.87   290.01  -0.05 │  1677936964963   1679788837493  -0.11 │  789388   790720   -0.17 │
│           rocq-metarocq-safechecker │  272.59   272.72  -0.05 │  2004204209543   2002478249362   0.09 │ 2068144  2035192    1.62 │
│                 rocq-metarocq-pcuic │  599.38   599.39  -0.00 │  3655690861333   3648120103993   0.21 │ 2905364  2923260   -0.61 │
│              coq-mathcomp-odd-order │  392.55   392.39   0.04 │  2728324311606   2729925548945  -0.06 │ 3693552  3690820    0.07 │
│                    coq-math-classes │   77.28    77.22   0.08 │   439877231617    440442649953  -0.13 │  547344   547440   -0.02 │
│                 coq-fourcolor-reals │    6.89     6.88   0.15 │    38952502684     39023857468  -0.18 │ 1071836  1076188   -0.40 │
│          rocq-metarocq-translations │   20.52    20.49   0.15 │   139642103868    139383619226   0.19 │ 1243580  1244860   -0.10 │
│        rocq-metarocq-template-pcuic │   38.58    38.51   0.18 │   238336426932    237414021164   0.39 │ 1319968  1286980    2.56 │
│                           rocq-elpi │   26.91    26.85   0.22 │   184123777695    184141342316  -0.01 │  496032   496108   -0.02 │
│              rocq-metarocq-template │   93.35    93.06   0.31 │   626627926905    624093519538   0.41 │ 1693412  1701208   -0.46 │
│                            coq-core │    5.93     5.91   0.34 │    42690829187     42690928581  -0.00 │  110144   110032    0.10 │
│                 rocq-mathcomp-reals │   43.69    43.49   0.46 │   268029014687    268309849571  -0.10 │ 2050196  2068672   -0.89 │
│                      rocq-equations │   14.84    14.39   3.13 │   101003905854    101053630834  -0.05 │  418656   418192    0.11 │
└─────────────────────────────────────┴─────────────────────────┴───────────────────────────────────────┴──────────────────────────┘

INFO: failed to install
coq-flocq (in NEW)

coq-compcert (dependency coq-flocq failed)
coq-vst (dependency coq-flocq failed)

🐢 Top 25 slow downs
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                           TOP 25 SLOW DOWNS                                                            │
│                                                                                                                                        │
│  OLD    NEW    DIFF   %DIFF    Ln                     FILE                                                                             │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  45.2   45.6  0.4019   0.89%     4  coq-fiat-crypto-with-bedrock/src/ExtractionJsOfOCaml/bedrock2_fiat_crypto.v.html                   │
│  24.2   24.5  0.3583   1.48%    68  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/deps/riscv-coq/src/riscv/Proofs/VerifyDecode.v.html │
│  9.66   10.0  0.3414   3.53%     3  coq-performance-tests-lite/PerformanceExperiments/Reify/Ltac2/_0_SuperFast.v.html                  │
│  25.9   26.2  0.2900   1.12%   223  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord32.v.html                                       │
│  18.0   18.3  0.2871   1.59%   272  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Jacobian.v.html                                      │
│  7.76   8.01  0.2527   3.26%   976  coq-category-theory/Instance/Grp/Colimit/Presentation.v.html                                       │
│  4.55   4.80  0.2457   5.40%   785  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/ExponentialEqs.v.html              │
│ 0.645  0.887  0.2419  37.50%  2054  rocq-metarocq-common/_build/default/theories/Common/LoopChecking/UnivLoopChecking.v.html           │
│  18.4   18.6  0.2338   1.27%    32  coq-performance-tests-lite/src/pattern.v.html                                                      │
│  26.5   26.7  0.2185   0.83%   310  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/Addchain.v.html                                 │
│  30.5   30.7  0.2136   0.70%   222  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord32.v.html                                       │
│  2.68   2.89  0.2068   7.71%   498  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/ExponentialPER.v.html              │
│  8.14   8.35  0.2065   2.54%    30  coq-engine-bench-lite/coq/PerformanceDemos/pattern.v.html                                          │
│  65.6   65.8  0.2006   0.31%   279  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Jacobian.v.html                                      │
│  35.1   35.3  0.1964   0.56%   221  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord32.v.html                                       │
│  21.2   21.4  0.1895   0.90%    13  coq-fourcolor/theories/proof/job219to222.v.html                                                    │
│  9.58   9.76  0.1820   1.90%    25  coq-fiat-crypto-with-bedrock/src/Curves/EdwardsMontgomery25519.v.html                              │
│ 0.886   1.07  0.1814  20.48%  1302  rocq-metarocq-pcuic/_build/default/theories/PCUIC/PCUICConversion.v.html                           │
│  19.8   20.0  0.1802   0.91%   560  coq-mathcomp-odd-order/theories/PFsection9.v.html                                                  │
│  1.29   1.47  0.1741  13.48%  1262  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/PERSubobjectClassifier.v.html      │
│  20.8   21.0  0.1719   0.82%   229  coq-unimath/UniMath/CategoryTheory/Presheaves/Sheafification.v.html                                │
│  13.0   13.2  0.1708   1.32%     3  coq-performance-tests-lite/PerformanceExperiments/sieve_of_eratosthenes/_1_SuperFast.v.html        │
│  3.89   4.06  0.1705   4.39%   129  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                       │
│  19.6   19.8  0.1680   0.85%    85  coq-fiat-crypto-with-bedrock/src/Curves/Montgomery/AffineProofs.v.html                             │
│  26.2   26.4  0.1661   0.63%   334  coq-fiat-crypto-with-bedrock/src/Bedrock/P256/Coord.v.html                                         │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                               TOP 25 SPEED UPS                                                               │
│                                                                                                                                              │
│ OLD    NEW    DIFF     %DIFF    Ln                      FILE                                                                                 │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 44.0   41.7  -2.3439   -5.33%   371  coq-fiat-crypto-with-bedrock/src/Stringification/Zig.v.html                                             │
│ 60.4   58.2  -2.1644   -3.58%     3  coq-performance-tests-lite/PerformanceExperiments/typeclass_reification_let_in_HOAS/_0_SuperFast.v.html │
│  288    286  -2.0890   -0.73%     3  coq-rewriter-perf-SuperFast/src/Rewriter/Rewriter/Examples/PerfTesting/LiftLetsMap/_10_SuperFast.v.html │
│  216    214  -1.6022   -0.74%     8  coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html           │
│ 45.4   43.9  -1.4864   -3.28%     3  coq-fiat-crypto-with-bedrock/src/ExtractionOCaml/fiat_crypto.v.html                                     │
│ 55.3   54.6  -0.7120   -1.29%   564  rocq-metarocq-erasure/_build/default/theories/Erasure/EConstantsToValues.v.html                         │
│ 44.2   43.6  -0.5093   -1.15%     3  coq-fiat-crypto-with-bedrock/src/ExtractionJsOfOCaml/fiat_crypto.v.html                                 │
│ 38.9   38.5  -0.4146   -1.07%   116  coq-fiat-crypto-with-bedrock/rupicola/bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html            │
│ 35.8   35.4  -0.3704   -1.04%    27  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ToFancyWithCasts.v.html                                │
│ 51.0   50.6  -0.3600   -0.71%   968  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                         │
│ 13.0   12.7  -0.3568   -2.74%   512  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/Logic/Universal.v.html                  │
│ 38.7   38.4  -0.3053   -0.79%   116  coq-bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html                                              │
│ 7.26   6.96  -0.2995   -4.13%   820  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/NNORecursiveMap.v.html                  │
│ 36.0   35.7  -0.2991   -0.83%   573  coq-fiat-crypto-with-bedrock/src/Bedrock/End2End/X25519/EdwardsXYZT.v.html                              │
│ 29.0   28.7  -0.2757   -0.95%    13  coq-fourcolor/theories/proof/job107to164.v.html                                                         │
│ 13.5   13.3  -0.2469   -1.82%   391  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/PartialEqRels/Logic/Existential.v.html                │
│ 1.96   1.72  -0.2400  -12.27%  1647  rocq-metarocq-erasure/_build/default/theories/ErasurePlugin/ErasureCorrectness.v.html                   │
│ 73.7   73.4  -0.2394   -0.33%   663  coq-fiat-crypto-with-bedrock/src/Bedrock/Secp256k1/JacobianCoZ.v.html                                   │
│ 1.06  0.823  -0.2386  -22.49%  1293  rocq-metarocq-pcuic/_build/default/theories/PCUIC/PCUICConversion.v.html                                │
│ 51.0   50.7  -0.2370   -0.46%   999  coq-performance-tests-lite/src/fiat_crypto_via_setoid_rewrite_standalone.v.html                         │
│ 2.17   1.93  -0.2315  -10.69%   990  rocq-metarocq-erasure/_build/default/theories/Erasure/ErasureFunction.v.html                            │
│ 25.7   25.4  -0.2234   -0.87%    13  coq-fourcolor/theories/proof/job291to294.v.html                                                         │
│ 70.9   70.7  -0.2102   -0.30%    22  coq-fiat-crypto-with-bedrock/src/Rewriter/Passes/ArithWithCasts.v.html                                  │
│ 42.6   42.3  -0.2074   -0.49%    52  coq-fiat-crypto-with-bedrock/src/Bedrock/Field/Synthesis/Examples/p224_64_new.v.html                    │
│ 1.05  0.844  -0.2041  -19.48%  1637  rocq-metarocq-common/_build/default/theories/Common/LoopChecking/UnivLoopChecking.v.html                │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant