Skip to content

Share the variable-free parts of let-bound value types - #9300

Draft
cknitt wants to merge 1 commit into
masterfrom
share-closed-types-9265
Draft

cknitt wants to merge 1 commit into
masterfrom
share-closed-types-9265

Conversation

@cknitt

@cknitt cknitt commented Nov 14, 2026

Copy link
Copy Markdown
Member

Fixes the main part of #9265.

Every use of a let-bound value copied the value's whole type, including the parts without type variables. For a value with a large inferred object or polymorphic variant type, that made each use cost a full copy: in time, in memory, and in the .cmt. Saving the .cmi copied the type again for every signature item.

What changes

  • Ctype.generalize_value generalizes the type of a let-bound value, but leaves the parts without type variables non-generic at the let's level. copy keeps non-generic nodes, so all uses share these parts. OCaml already treats the parts of a weak type this way, so unification and later generalizations handle them as usual.
  • Subst.for_saving_signature, used only to save a .cmi, copies each such part once for the whole signature instead of once per item.

The shared parts can still be linked to equal types or have their level lowered, as weak types can. Their object fields' mutability can't be promoted: their rows are closed, and mutability cells are only merged together with their rows' tails. The comment on generalize_value explains this.

Not in this PR

  • Top-level values still pay about 1 ms per use for a 400-field type. The interface check copies each value's type twice (Subst.value_description in Includemod, and duplicate_type in moregeneral), and several callers rely on those copies to fix levels.
  • Values from other modules (types loaded from a .cmi) are still copied at each use.

Numbers (linux-arm64, master vs this PR, identical JS)

case master PR
stress/ObjectFields.res: time 192 ms 38 ms
stress/ObjectFields.res: allocated words 20.7M 3.9M
stress/ObjectFields.res: .cmt 7.98 MB 207 KB
400-field object, 400 top-level uses: .cmt / .cmi 8.85 MB / 8.9 MB 114 KB / 37 KB
same 400 uses inside a function: time 271 ms 47 ms

Tests

tests/tests/src/shared_variable_free_types.res uses values with variable-free object and variant types through open objects, settable fields, recursion, GADT branches and a weak ref.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gLMbg8G3FeSq6sPLM2

Why:
    Every use of a let-bound value copied its whole type, even the parts
    without type variables. For a value with a 400-field object type,
    each use added about 22 KB to the .cmt, and saving the .cmi copied the
    type again for every signature item (#9265).

The parts of a let-bound value's type that contain no type variable now
stay non-generic at the binding's level, like the parts of a weak type.
Instantiation keeps non-generic nodes, so all uses share them. Saving a
signature copies each such part once for the whole .cmi, reusing a copy
only under the path substitution it was made with. Generic nodes never
count as variable-free, so a shared part never contains one.

Typing: Ctype.generalize_value (let-bound patterns)
    let o = {"f0": 0, /* … 400 fields */}
    let g0 = o
    let g1 = o
Before (text): generalize o's type: every node generic, each use copies all 400 fields
After (text): generalize o's type: variable-free nodes stay at the let's level, each use shares them

Review: Can a shared part change after it is shared? Unification may link
it to an equal type or lower its level, as for weak types. The mutability
cells of its object fields can't be promoted: its rows are closed, and
cells are merged only together with their rows' tails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLMbg8G3FeSq6sPLM2
Signed-off-by: Christoph Knittel <ck@cca.io>
@github-actions

Copy link
Copy Markdown

Changelog

💅 Polish

  • Compile values with large object or polymorphic variant types faster and write much smaller .cmt and .cmi files for them, by sharing the parts of their types that contain no type variable instead of copying them at every use.

Semantic Diff

1 commit · Full page

Share the variable-free parts of let-bound value types

33709fb · cknitt + Claude · Nov 14, 2026, 08:37 UTC

Why

Every use of a let-bound value copied its whole type, even the parts without type variables. For a value with a 400-field object type, each use added about 22 KB to the .cmt, and saving the .cmi copied the type again for every signature item (#9265).

The parts of a let-bound value's type that contain no type variable now stay non-generic at the binding's level, like the parts of a weak type. Instantiation keeps non-generic nodes, so all uses share them. Saving a signature copies each such part once for the whole .cmi, reusing a copy only under the path substitution it was made with. Generic nodes never count as variable-free, so a shared part never contains one.

Typing: Ctype.generalize_value (let-bound patterns)

let o = {"f0": 0, /* … 400 fields */}
let g0 = o
let g1 = o

text

-generalize o's type: every node generic, each use copies all 400 fields
+generalize o's type: variable-free nodes stay at the let's level, each use shares them

Review

  • Can a shared part change after it is shared? Unification may link it to an equal type or lower its level, as for weak types. The mutability cells of its object fields can't be promoted: its rows are closed, and cells are merged only together with their rows' tails.

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.37864% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.12%. Comparing base (9523348) to head (33709fb).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
compiler/ml/subst.ml 83.56% 12 Missing ⚠️
compiler/ml/ctype.ml 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9300      +/-   ##
==========================================
+ Coverage   82.06%   82.12%   +0.06%     
==========================================
  Files         455      455              
  Lines       65399    65457      +58     
==========================================
+ Hits        53672    53759      +87     
+ Misses      11727    11698      -29     
Files with missing lines Coverage Δ
compiler/ml/env.ml 80.00% <100.00%> (-0.21%) ⬇️
compiler/ml/typecore.ml 89.15% <100.00%> (ø)
compiler/ml/ctype.ml 72.22% <96.42%> (+1.64%) ⬆️
compiler/ml/subst.ml 88.00% <83.56%> (+2.11%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

⚠️ Compiler benchmarks

Allocated words

In total: 640,953,072 → 627,509,688 (-2.10%).

Generated projects: 920,898,327 → 924,318,969 (+0.37%).

⚠️ Regression: 67 benchmarks allocate more than 1% more.

🎉 Improvement: 2 benchmarks allocate more than 1% less.

Benchmark Base Head Change
stress/ObjectFields.res 20,692,937 3,817,948 -81.55%
stress/Record.res 26,163,126 28,887,043 +10.41%
packages/@rescript/runtime/JsxEvent.res 1,088,126 1,120,310 +2.96%
packages/@rescript/runtime/Stdlib_Int8Array.res 343,007 351,808 +2.57%
packages/@rescript/runtime/Stdlib_Uint8Array.res 343,022 351,823 +2.57%
packages/@rescript/runtime/Stdlib_Float32Array.res 343,125 351,926 +2.56%
packages/@rescript/runtime/Stdlib_Float64Array.res 343,125 351,926 +2.56%
packages/@rescript/runtime/Stdlib_Int16Array.res 343,154 351,955 +2.56%
packages/@rescript/runtime/Stdlib_Int32Array.res 343,156 351,957 +2.56%
packages/@rescript/runtime/Stdlib_Uint16Array.res 343,161 351,962 +2.56%
230 more changes
Benchmark Base Head Change
packages/@rescript/runtime/Stdlib_Uint32Array.res 343,161 351,962 +2.56%
packages/@rescript/runtime/Stdlib_BigInt64Array.res 343,187 351,988 +2.56%
packages/@rescript/runtime/Stdlib_BigUint64Array.res 343,261 352,062 +2.56%
packages/@rescript/runtime/Stdlib_Uint8ClampedArray.res 343,537 352,338 +2.56%
packages/@rescript/belt/src/Belt_MutableSetString.resi 264,520 270,301 +2.19%
packages/@rescript/belt/src/Belt_MutableSetInt.resi 264,637 270,418 +2.18%
packages/@rescript/belt/src/Belt_SetString.resi 259,460 264,922 +2.11%
packages/@rescript/belt/src/Belt_SetInt.resi 259,587 265,049 +2.10%
packages/@rescript/runtime/Stdlib_String.resi 500,056 509,645 +1.92%
stress/InlineChain.res 3,586,473 3,518,750 -1.89%
packages/@rescript/runtime/Stdlib_DataView.resi 269,452 274,409 +1.84%
packages/@rescript/runtime/Stdlib_Date.resi 618,515 629,737 +1.81%
packages/@rescript/runtime/JsxDOM.res 2,663,329 2,710,691 +1.78%
packages/@rescript/runtime/Stdlib_TypedArray.res 782,668 795,550 +1.65%
packages/@rescript/runtime/Stdlib_Math.resi 330,668 335,893 +1.58%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 572,213 580,989 +1.53%
packages/@rescript/runtime/Stdlib_Intl_NumberFormat.res 403,726 409,833 +1.51%
packages/@rescript/runtime/JsxDOMStyle.res 1,935,139 1,963,667 +1.47%
packages/@rescript/runtime/Stdlib_BigInt.resi 186,319 189,041 +1.46%
packages/@rescript/runtime/Stdlib_Int.resi 205,684 208,657 +1.45%
packages/@rescript/belt/src/Belt_MapString.resi 390,789 396,403 +1.44%
packages/@rescript/belt/src/Belt_MapInt.resi 390,832 396,446 +1.44%
packages/@rescript/belt/src/Belt_Range.resi 176,345 178,859 +1.43%
packages/@rescript/belt/src/Belt_MutableMapString.resi 314,517 318,919 +1.40%
packages/@rescript/belt/src/Belt_MutableMapInt.resi 314,635 319,037 +1.40%
packages/@rescript/runtime/Stdlib_JSON.resi 236,632 239,845 +1.36%
packages/@rescript/belt/src/Belt_Array.resi 649,780 658,360 +1.32%
packages/@rescript/belt/src/Belt_HashSetString.resi 175,186 177,498 +1.32%
packages/@rescript/belt/src/Belt_HashSetInt.resi 175,299 177,611 +1.32%
packages/@rescript/belt/src/Belt_SortArrayString.resi 169,264 171,482 +1.31%
packages/@rescript/belt/src/Belt_SortArrayInt.resi 169,382 171,600 +1.31%
packages/@rescript/runtime/Stdlib_Intl_DateTimeFormat.res 388,733 393,729 +1.29%
packages/@rescript/runtime/Stdlib_Float.resi 194,410 196,848 +1.25%
packages/@rescript/runtime/Stdlib_Intl_Locale.res 197,104 199,529 +1.23%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 436,952 442,309 +1.23%
packages/@rescript/runtime/Stdlib_Intl_PluralRules.res 201,187 203,626 +1.21%
packages/@rescript/runtime/Stdlib_Array.resi 731,799 740,632 +1.21%
packages/@rescript/belt/src/Belt_SortArray.resi 253,602 256,632 +1.19%
packages/@rescript/runtime/Pervasives.res 238,946 241,798 +1.19%
packages/@rescript/runtime/Stdlib_RegExp.resi 188,008 190,220 +1.18%
packages/@rescript/runtime/Stdlib_List.resi 409,316 414,054 +1.16%
packages/@rescript/runtime/Stdlib_Global.resi 155,748 157,550 +1.16%
packages/@rescript/belt/src/Belt_List.resi 758,037 766,802 +1.16%
packages/@rescript/belt/src/Belt_HashMapString.resi 213,323 215,763 +1.14%
packages/@rescript/belt/src/Belt_HashMapInt.resi 213,438 215,878 +1.14%
packages/@rescript/runtime/Stdlib_Temporal_Duration.res 372,680 376,901 +1.13%
packages/@rescript/runtime/Stdlib_Intl_Collator.res 178,061 180,046 +1.11%
packages/@rescript/runtime/RescriptTools_Docgen.resi 273,198 276,229 +1.11%
packages/@rescript/runtime/Stdlib_Intl_RelativeTimeFormat.res 179,823 181,813 +1.11%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 402,875 407,309 +1.10%
packages/@rescript/runtime/Stdlib_Intl_ListFormat.res 169,182 171,041 +1.10%
packages/@rescript/runtime/Primitive_object.resi 116,785 118,060 +1.09%
packages/@rescript/runtime/Stdlib_Temporal_PlainYearMonth.res 381,518 385,676 +1.09%
packages/@rescript/runtime/Stdlib_JsError.resi 185,017 187,009 +1.08%
packages/@rescript/runtime/Dom_storage2.res 119,500 120,779 +1.07%
packages/@rescript/belt/src/Belt_internalAVLset.resi 354,498 358,225 +1.05%
packages/@rescript/belt/src/Belt_Id.resi 259,765 262,438 +1.03%
packages/@rescript/runtime/Stdlib_JsExn.resi 122,411 123,670 +1.03%
packages/@rescript/runtime/Stdlib_Promise.resi 357,183 360,834 +1.02%
packages/@rescript/runtime/Stdlib_Bool.resi 116,439 117,596 +0.99%
packages/@rescript/runtime/Stdlib_Intl_Segmenter.res 153,928 155,437 +0.98%
packages/@rescript/belt/src/Belt_Range.res 290,830 287,981 -0.98%
packages/@rescript/runtime/Primitive_hash.resi 102,460 103,458 +0.97%
packages/@rescript/runtime/Stdlib_Option.resi 236,082 238,381 +0.97%
packages/@rescript/belt/src/Belt_internalAVLtree.resi 452,025 456,377 +0.96%
packages/@rescript/belt/src/Belt_MutableMap.resi 394,963 398,764 +0.96%
packages/@rescript/belt/src/Belt_MapDict.resi 513,036 517,962 +0.96%
build/leaf-edit 13,199,588 13,073,160 -0.96%
packages/@rescript/runtime/Stdlib_Dict.resi 241,025 243,312 +0.95%
packages/@rescript/runtime/Jsx.res 121,263 122,410 +0.95%
packages/@rescript/runtime/Primitive_object_extern.res 114,249 115,315 +0.93%
packages/@rescript/belt/src/Belt_Int.resi 149,374 150,767 +0.93%
packages/@rescript/runtime/Stdlib_Console.resi 414,802 418,659 +0.93%
packages/@rescript/belt/src/Belt_Float.resi 150,850 152,243 +0.92%
packages/@rescript/belt/src/Belt_MutableSet.resi 397,070 400,730 +0.92%
packages/@rescript/runtime/Primitive_module.resi 102,889 103,837 +0.92%
build/Namespace/clean 188,726,130 190,461,973 +0.92%
packages/@rescript/runtime/Stdlib_Result.resi 295,970 298,688 +0.92%
packages/@rescript/runtime/Stdlib_ArrayBuffer.resi 110,787 111,799 +0.91%
packages/@rescript/runtime/Stdlib_Symbol.resi 159,856 161,288 +0.90%
packages/@rescript/runtime/Primitive_option.resi 121,949 123,038 +0.89%
packages/@rescript/belt/src/Belt_MutableStack.resi 168,943 170,451 +0.89%
packages/@rescript/belt/src/Belt_Option.resi 242,987 245,131 +0.88%
packages/@rescript/belt/src/Belt_MutableQueue.resi 206,951 208,751 +0.87%
packages/@rescript/runtime/Stdlib_IteratorObject.resi 235,063 237,094 +0.86%
packages/@rescript/runtime/Stdlib_Intl_Segments.res 116,128 117,111 +0.85%
packages/@rescript/belt/src/Belt_SetDict.resi 402,438 405,844 +0.85%
packages/@rescript/runtime/Primitive_array_extern.res 113,864 114,825 +0.84%
packages/@rescript/runtime/Primitive_exceptions.resi 100,023 100,860 +0.84%
packages/@rescript/runtime/Primitive_int_extern.res 97,546 98,360 +0.83%
packages/@rescript/runtime/Primitive_string_extern.res 97,864 98,678 +0.83%
packages/@rescript/belt/src/Belt_Set.resi 436,960 440,593 +0.83%
packages/@rescript/belt/src/Belt_Map.resi 578,955 583,760 +0.83%
packages/@rescript/runtime/Stdlib_Set.resi 229,602 231,501 +0.83%
packages/@rescript/runtime/Stdlib_Map.resi 217,646 219,434 +0.82%
packages/@rescript/runtime/Stdlib_Temporal_PlainTime.res 319,810 322,434 +0.82%
packages/@rescript/runtime/Stdlib_JsExn.res 173,265 171,872 -0.80%
packages/@rescript/belt/src/Belt_HashSet.resi 222,411 224,176 +0.79%
packages/@rescript/runtime/Stdlib_AsyncIterator.resi 177,553 178,943 +0.78%
packages/@rescript/runtime/Primitive_dict.res 102,332 103,124 +0.77%
packages/@rescript/runtime/Stdlib_Object.res 244,958 246,832 +0.77%
packages/@rescript/runtime/Stdlib_Nullable.resi 199,645 201,169 +0.76%
packages/@rescript/runtime/Primitive_list.resi 91,618 92,300 +0.74%
packages/@rescript/runtime/Stdlib_Lazy.resi 112,112 112,946 +0.74%
packages/@rescript/runtime/Primitive_float_extern.res 93,329 94,020 +0.74%
packages/@rescript/runtime/Stdlib_Type.resi 135,558 136,555 +0.74%
packages/@rescript/runtime/Stdlib_Null.resi 204,329 205,831 +0.74%
packages/@rescript/runtime/Stdlib_AsyncIterableIterator.resi 159,538 160,710 +0.73%
packages/@rescript/runtime/Stdlib_Iterator.resi 159,015 160,181 +0.73%
packages/@rescript/runtime/Stdlib_WeakSet.res 122,602 123,491 +0.73%
packages/@rescript/belt/src/Belt_HashMap.resi 296,518 298,651 +0.72%
packages/@rescript/belt/src/Belt_Result.resi 239,817 241,529 +0.71%
packages/@rescript/runtime/Stdlib_Temporal_Instant.res 307,218 309,404 +0.71%
packages/@rescript/runtime/Stdlib_IterableIterator.resi 149,136 150,195 +0.71%
packages/@rescript/runtime/RescriptTools_ExtractCodeBlocks.res 111,761 112,552 +0.71%
packages/@rescript/runtime/Stdlib_TaggedTemplate.resi 105,844 106,593 +0.71%
packages/@rescript/runtime/Stdlib_Iterable.resi 97,865 98,555 +0.71%
packages/@rescript/runtime/Stdlib_AsyncIterable.resi 98,012 98,702 +0.70%
packages/@rescript/runtime/Primitive_promise.res 96,696 97,376 +0.70%
packages/@rescript/runtime/Stdlib_Intl_NumberFormat_Grouping.res 159,846 160,966 +0.70%
packages/@rescript/runtime/Stdlib_WeakMap.res 134,943 135,879 +0.69%
packages/@rescript/runtime/Stdlib_Ordering.res 152,140 153,177 +0.68%
packages/@rescript/runtime/Stdlib_File.res 95,287 95,932 +0.68%
build/no-op 9,307,791 9,245,501 -0.67%
packages/@rescript/runtime/Obj.res 98,786 99,446 +0.67%
packages/@rescript/runtime/Dom.res 1,068,580 1,075,697 +0.67%
packages/@rescript/runtime/Stdlib_Pair.res 165,640 166,739 +0.66%
packages/@rescript/runtime/Stdlib_Blob.res 93,493 94,113 +0.66%
packages/@rescript/belt/src/Belt_MutableSetInt.res 1,691,616 1,680,495 -0.66%
packages/@rescript/belt/src/Belt_MutableSetString.res 1,692,859 1,681,737 -0.66%
packages/@rescript/belt/src/Belt_internalBuckets.resi 222,871 224,323 +0.65%
packages/@rescript/belt/src/Belt_internalSetBuckets.resi 194,058 195,320 +0.65%
packages/@rescript/runtime/Stdlib_AsyncGenerator.resi 165,537 166,607 +0.65%
packages/@rescript/runtime/Stdlib_Intl_Common.res 153,945 154,923 +0.64%
packages/@rescript/belt/src/Belt_internalBucketsType.resi 164,500 165,545 +0.64%
packages/@rescript/runtime/Stdlib_Iterable.res 98,555 99,174 +0.63%
packages/@rescript/runtime/Stdlib_AsyncIterable.res 98,626 99,245 +0.63%
packages/@rescript/runtime/Dom_storage.res 166,901 167,942 +0.62%
packages/@rescript/runtime/Stdlib_Generator.resi 160,185 161,183 +0.62%
packages/@rescript/runtime/RescriptTools.res 104,127 104,772 +0.62%
packages/@rescript/runtime/Stdlib_ArrayBuffer.res 107,067 107,686 +0.58%
packages/@rescript/runtime/Stdlib_Temporal_PlainMonthDay.res 268,042 269,581 +0.57%
packages/@rescript/runtime/Stdlib_TaggedTemplate.res 115,020 115,675 +0.57%
packages/@rescript/runtime/Primitive_object.res 1,171,634 1,165,062 -0.56%
packages/@rescript/runtime/Stdlib_Iterator.res 235,191 236,510 +0.56%
packages/@rescript/runtime/Stdlib_Intl.res 173,941 174,898 +0.55%
packages/@rescript/runtime/Primitive_bool.res 147,350 148,126 +0.53%
packages/@rescript/runtime/Primitive_float.res 147,391 148,165 +0.53%
packages/@rescript/runtime/Primitive_string.res 160,147 160,974 +0.52%
packages/@rescript/runtime/Primitive_array.res 193,451 194,448 +0.52%
packages/@rescript/runtime/Primitive_int.res 172,514 173,392 +0.51%
packages/@rescript/runtime/Stdlib_IterableIterator.res 178,852 179,740 +0.50%
packages/@rescript/runtime/Primitive_bigint.res 177,966 178,844 +0.49%
packages/@rescript/runtime/Stdlib_Lazy.res 222,162 223,253 +0.49%
packages/@rescript/runtime/Stdlib_AsyncIterator.res 295,783 297,227 +0.49%
packages/@rescript/runtime/Primitive_list.res 205,182 206,131 +0.46%
packages/@rescript/runtime/Stdlib_Global.res 141,333 141,958 +0.44%
packages/@rescript/runtime/Stdlib_AsyncGenerator.res 211,504 212,430 +0.44%
packages/@rescript/runtime/Stdlib_AsyncIterableIterator.res 228,980 229,977 +0.44%
packages/@rescript/belt/src/Belt_Option.res 391,673 393,364 +0.43%
packages/@rescript/runtime/Stdlib_Generator.res 200,658 201,524 +0.43%
packages/@rescript/runtime/Stdlib_Symbol.res 144,093 144,712 +0.43%
stress/LetRec.res 32,165,671 32,299,438 +0.42%
packages/@rescript/belt/src/Belt_Map.res 993,336 997,449 +0.41%
packages/@rescript/runtime/Stdlib_JsError.res 230,039 230,959 +0.40%
packages/@rescript/runtime/Primitive_exceptions.res 201,869 202,668 +0.40%
packages/@rescript/runtime/Stdlib_Null.res 334,315 335,627 +0.39%
packages/@rescript/runtime/Primitive_js_extern.res 239,405 240,344 +0.39%
packages/@rescript/runtime/Stdlib_Nullable.res 331,850 333,148 +0.39%
packages/@rescript/belt/src/Belt_Set.res 869,516 872,896 +0.39%
packages/@rescript/belt/src/Belt_Float.res 164,761 165,401 +0.39%
packages/@rescript/belt/src/Belt_Int.res 165,430 166,070 +0.39%
packages/@rescript/belt/src/Belt_Result.res 411,989 413,575 +0.38%
packages/@rescript/runtime/Stdlib_RegExp.res 162,824 163,448 +0.38%
packages/@rescript/belt/src/Belt.res 188,177 188,895 +0.38%
packages/@rescript/runtime/Stdlib_Dict.res 319,618 320,836 +0.38%
packages/@rescript/belt/src/Belt_SortArrayInt.res 1,361,176 1,356,131 -0.37%
packages/@rescript/belt/src/Belt_SortArrayString.res 1,362,972 1,357,930 -0.37%
packages/@rescript/runtime/Stdlib_Bool.res 146,054 146,589 +0.37%
packages/@rescript/belt/src/Belt_MapDict.res 1,654,983 1,660,500 +0.33%
packages/@rescript/belt/src/Belt_Id.res 289,988 290,943 +0.33%
packages/@rescript/runtime/Stdlib_Type.res 201,446 202,109 +0.33%
packages/@rescript/runtime/Stdlib_Map.res 205,392 206,057 +0.32%
packages/@rescript/runtime/Stdlib_Set.res 210,623 211,289 +0.32%
packages/@rescript/belt/src/Belt_MutableQueue.res 799,705 802,124 +0.30%
packages/@rescript/belt/src/Belt_SetDict.res 1,468,191 1,472,593 +0.30%
packages/@rescript/runtime/Stdlib_IteratorObject.res 250,980 251,732 +0.30%
packages/@rescript/belt/src/Belt_internalBucketsType.res 292,515 293,382 +0.30%
packages/@rescript/runtime/Stdlib_Temporal_Now.res 142,914 143,328 +0.29%
packages/@rescript/runtime/Stdlib_Option.res 762,298 764,493 +0.29%
build/shared-edit 72,920,431 72,718,304 -0.28%
packages/@rescript/runtime/Stdlib_Float.res 218,563 219,157 +0.27%
packages/@rescript/runtime/Stdlib_DataView.res 230,065 230,685 +0.27%
packages/@rescript/belt/src/Belt_MutableStack.res 390,358 391,400 +0.27%
packages/@rescript/belt/src/Belt_MutableMap.res 1,320,213 1,323,710 +0.26%
packages/@rescript/belt/src/Belt_internalBuckets.res 977,537 980,016 +0.25%
packages/@rescript/runtime/Stdlib_Temporal_Common.res 365,984 366,900 +0.25%
packages/@rescript/belt/src/Belt_internalSetBuckets.res 705,944 707,701 +0.25%
packages/@rescript/runtime/Stdlib_BigInt.res 206,835 207,346 +0.25%
build/WideDeps/clean 495,965,329 497,190,528 +0.25%
packages/@rescript/belt/src/Belt_MutableSet.res 1,934,212 1,938,967 +0.25%
packages/@rescript/belt/src/Belt_internalMapInt.res 1,432,014 1,435,502 +0.24%
packages/@rescript/belt/src/Belt_internalMapString.res 1,433,864 1,437,346 +0.24%
packages/@rescript/runtime/Stdlib_Array.res 1,293,092 1,296,163 +0.24%
packages/@rescript/runtime/Stdlib.res 982,387 984,617 +0.23%
packages/@rescript/belt/src/Belt_HashSetString.res 862,829 860,872 -0.23%
packages/@rescript/belt/src/Belt_HashSetInt.res 862,510 860,556 -0.23%
packages/@rescript/runtime/RescriptTools_Docgen.res 283,381 284,022 +0.23%
packages/@rescript/belt/src/Belt_HashSet.res 991,667 993,849 +0.22%
packages/@rescript/belt/src/Belt_MapInt.res 1,196,915 1,199,490 +0.22%
packages/@rescript/belt/src/Belt_MapString.res 1,197,451 1,200,026 +0.22%
packages/@rescript/belt/src/Belt_internalAVLtree.res 3,550,767 3,558,355 +0.21%
packages/@rescript/runtime/Stdlib_Result.res 1,279,829 1,282,554 +0.21%
packages/@rescript/runtime/Stdlib_List.res 2,726,309 2,731,904 +0.21%
packages/@rescript/runtime/Primitive_hash.res 976,384 974,428 -0.20%
packages/@rescript/runtime/Stdlib_Promise.res 351,730 352,428 +0.20%
build/WideDeps/edit 228,263,350 228,715,855 +0.20%
packages/@rescript/belt/src/Belt_List.res 3,219,561 3,225,874 +0.20%
packages/@rescript/belt/src/Belt_Array.res 2,186,895 2,191,048 +0.19%
packages/@rescript/runtime/Stdlib_Console.res 369,774 370,426 +0.18%
build/clean 238,622,639 239,016,205 +0.16%
packages/@rescript/runtime/Stdlib_Math.res 326,844 327,362 +0.16%
packages/@rescript/belt/src/Belt_HashMap.res 1,217,499 1,219,369 +0.15%
packages/@rescript/runtime/Stdlib_JSON.res 297,562 298,016 +0.15%
packages/@rescript/runtime/Stdlib_Int.res 457,244 457,923 +0.15%
packages/@rescript/belt/src/Belt_internalAVLset.res 2,912,931 2,916,356 +0.12%
packages/@rescript/belt/src/Belt_HashMapString.res 1,077,238 1,078,451 +0.11%
packages/@rescript/belt/src/Belt_HashMapInt.res 1,076,526 1,077,738 +0.11%
packages/@rescript/belt/src/Belt_internalSetInt.res 740,601 739,852 -0.10%
packages/@rescript/belt/src/Belt_internalSetString.res 741,792 741,044 -0.10%

Instructions

In total: 9,209,713,949 → 8,594,939,879 (-6.68%).

⚠️ Regression: 14 benchmarks execute more than 1% more instructions.

🎉 Improvement: 2 benchmarks execute more than 1% fewer instructions.

Benchmark Base Head Change
stress/ObjectFields.res 944,730,957 188,651,260 -80.03%
stress/Record.res 1,071,521,904 1,186,111,555 +10.69%
packages/@rescript/runtime/JsxDOM.res 117,141,617 120,157,437 +2.57%
packages/@rescript/runtime/Stdlib_String.resi 29,383,546 29,949,397 +1.93%
packages/@rescript/runtime/JsxDOMStyle.res 95,109,108 96,896,770 +1.88%
packages/@rescript/runtime/Stdlib_Date.resi 34,160,628 34,779,247 +1.81%
packages/@rescript/runtime/Stdlib_TypedArray.res 41,141,795 41,841,743 +1.70%
stress/InlineChain.res 137,106,192 134,904,710 -1.61%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 31,091,934 31,581,703 +1.58%
packages/@rescript/belt/src/Belt_Array.resi 33,741,533 34,231,158 +1.45%
9 more changes
Benchmark Base Head Change
stress/LetRec.res 1,371,741,676 1,391,367,094 +1.43%
packages/@rescript/belt/src/Belt_List.resi 39,012,298 39,542,754 +1.36%
packages/@rescript/runtime/Stdlib_Array.resi 39,993,388 40,513,511 +1.30%
packages/@rescript/runtime/Stdlib_Math.resi 21,221,577 21,493,831 +1.28%
packages/@rescript/runtime/Stdlib_List.resi 24,554,397 24,809,950 +1.04%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 25,458,857 25,720,311 +1.03%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 24,023,852 24,248,343 +0.93%
stress/TypeAliasChain.res 171,864,465 171,062,397 -0.47%
packages/@rescript/belt/src/Belt_List.res 117,684,589 117,877,234 +0.16%

Output size

In total: 25,843,406 → 25,628,328 (-0.83%).

🎉 Improvement: 2 outputs are more than 1% smaller.

Benchmark Base Head Change
output/tests/*.cmt 11,008,680 10,851,072 -1.43%
output/belt/*.cmt 2,752,795 2,713,875 -1.41%
output/tests/*.cmi 2,340,711 2,327,679 -0.56%
output/runtime/*.cmt 3,044,137 3,037,987 -0.20%

Pull request 33709fb compared with base 1efa212 in this run.

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9300

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9300

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9300

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9300

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9300

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9300

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9300

commit: 33709fb

This branch has not been deployed

No deployments
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.

1 participant