Skip to content

feat(formatter): support range formatting for JS/TS and Markdown - #1819

Open
magic-akari wants to merge 8 commits into
mainfrom
feat/js-formatter-range
Open

magic-akari wants to merge 8 commits into
mainfrom
feat/js-formatter-range

Conversation

@magic-akari

@magic-akari magic-akari commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Motivation

Editors need to format a selection while preserving the surrounding text. Selecting the first of two declarations should produce a single edit to that declaration. The next statement can still affect the edit. For example, even with semi: false, a declaration needs its trailing semicolon when the next line starts with [0].forEach(log).

Changes

  • Add format_range and format_ast_range to the Rust JS/TS and Markdown APIs. Both accept a single half-open range in UTF-8 bytes and return at most one text edit.
  • Expand JS/TS selections to complete statements, preserving attached comments, ignore directives, and semicolons required at the selection boundary.
  • Expand Markdown selections to complete top-level blocks. Run embedded formatters only for selected blocks.
  • Expose formatRange from the native npm language plugins. It returns a replacement Doc and its UTF-16 bounds. The native and Wasm hosts use printRange to render the edit at its original column.
  • Keep whole-file formatting efficient by skipping selection capture in ordinary JS/TS statement lists and rendering ordinary Markdown blocks directly.

For JS/TS, Prettier’s --debug-check still checks that formatting twice produces the same output. AST comparison is deferred until the plugin can return a normalized ESTree program.

Host compatibility

Rust and native/Wasm npm hosts. These hosts call SWC’s range formatter directly. They support JS/TS and Markdown selections independently of Prettier.

Prettier plugin. After this PR merges, @swc-next/formatter-prettier-plugin users on Prettier 3.10.1 or 3.10.2 will still have whole-file formatting only. Range formatting through Prettier requires the printer.getRangeNodes hook proposed in prettier/prettier#20264.

The adapter uses the proposed hook to pass the full source and the user’s original selection to Rust. We verified this behavior with the preview build at prettier/prettier@51839f643. If the hook’s signature or range-selection behavior changes before release, we will need to update the SWC Prettier plugin to match the final API.

Related Links

Expand a selection to statements in the original program so range edits
preserve attached comments, ignore directives, and semicolon boundaries.

Return replacement edits from the Rust source and AST APIs. Pass the
selected Doc and its UTF-16 bounds between npm bindings so the native
host can print it at its original column. Use the same selection with
Prettier hosts that implement getRangeNodes.
The JavaScript parser wraps the source text, so quote style changes appear as AST differences. Return a constant comparison value until the plugin provides a normalized ESTree program.
Expand a selection to complete Markdown blocks so list markers and
fence delimiters stay consistent. Resolve references against the full
document and dispatch only embedded blocks within the selection.

Expose source and AST range edits in Rust. Pass the selected Doc and
its UTF-16 bounds to the native and Prettier hosts.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Deploying swc-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8aea26b
Status: ✅  Deploy successful!
Preview URL: https://08561392.swc-next.pages.dev
Branch Preview URL: https://feat-js-formatter-range.swc-next.pages.dev

View logs

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Binary size diff

Linux x64 GNU · release · uncompressed, stripped bindings.

Merge: 72126099c28ca8a0f41d8931ea57d98f26b9fd12; base: f6f4151d645e55d9271991b0fbfc87f940ed3197.

Artifact Merge Base Change (bytes) Change (%)
@swc-next/core 4,437.44 KiB 4,437.44 KiB 0 0.000% ⚪
@swc-next/parser 1,387.63 KiB 1,387.63 KiB 0 0.000% ⚪
@swc-next/generator 603.15 KiB 603.15 KiB 0 0.000% ⚪
@swc-next/transformer 4,408.69 KiB 4,408.69 KiB 0 0.000% ⚪

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Gungraun benchmark diff

Base SHA: f6f4151
Compare SHA: 7212609

Values are shown as compare / base.

Download the raw Gungraun and Valgrind data (retained for 90 days).

Callgrind metric changes

Callgrind instruction counts (Ir) for the compare and base revisions. Values are shown as compare / base in K (1,000), truncated to whole thousands. Multi-part profiles use the part numbers from Gungraun and include an aggregated Total. New and Removed identify benchmarks that exist on only one side; the missing value is shown as a dash. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged.

Formatter
Benchmark Ir (K) Change
formatter/angular 73,453 / 73,639 −0.252% 🟢
formatter/astro_config 4,346 / 4,348 −0.035% 🟢
formatter/backbone 10,975 / 11,034 −0.54% 🟢
formatter/effect_schema_ast 23,627 / 23,717 −0.38% 🟢
formatter/hono_types 16,025 / 16,031 −0.038% 🟢
formatter/jquery_mobile 94,581 / 95,000 −0.441% 🟢
formatter/mootools 46,805 / 47,050 −0.521% 🟢
formatter/three 254,153 / 255,137 −0.385% 🟢
formatter/typescript 1,424,108 / 1,427,687 −0.251% 🟢
formatter/underscore 9,821 / 9,873 −0.525% 🟢
formatter/yui 46,329 / 46,445 −0.251% 🟢
markdown_formatter/biome_readme 285 / 287 −0.59% 🟢
markdown_formatter/nix_changelog 4,682 / 4,706 −0.513% 🟢
markdown_formatter/prettier_options 1,053 / 1,062 −0.807% 🟢
Generator
Benchmark Ir (K) Change
cal_com_tsx 49,266 / 49,266 +0.001% 🔴
typescript 371,380 / 371,380 0% ⚪
Minifier
Benchmark Ir (K) Change
angular 19,087 / 19,086 +0.004% 🔴
semantic 43 / 43 0% ⚪
typescript 385,745 / 385,746 0% ⚪
underscore 2,778 / 2,777 +0.008% 🔴
Parser
Benchmark Ir (K) Change
markdown_parser/biome_readme 316 / 316 +0.021% 🔴
markdown_parser/nix_changelog 8,110 / 8,110 +0.001% 🔴
markdown_parser/prettier_options 1,600 / 1,601 −0.01% 🟢
parser/angular 7,971 / 7,971 +0.004% 🔴
parser/backbone 1,267 / 1,267 −0.003% 🟢
parser/cal_com_tsx 25,103 / 25,103 −0.001% 🟢
parser/hono_types 2,898 / 2,898 −0.002% 🟢
parser/jquery 6,669 / 6,668 +0.004% 🔴
parser/jquery_mobile 10,304 / 10,304 +0.001% 🔴
parser/mootools 5,499 / 5,499 0% ⚪
parser/three 32,274 / 32,274 −0.001% 🟢
parser/typescript 162,356 / 162,356 0% ⚪
parser/underscore 1,131 / 1,131 +0.002% 🔴
parser/yui 5,176 / 5,176 −0.001% 🟢
Semantic
Benchmark Ir (K) Change
analyze/cal_com_tsx 15,944 / 15,945 −0.003% 🟢
analyze/typescript 129,368 / 129,370 −0.001% 🟢
analyze/typescript_checker 55,504 / 55,504 0% ⚪
syntax_check/cal_com_tsx 26,798 / 26,800 −0.006% 🟢
syntax_check/typescript 178,137 / 178,137 0% ⚪
syntax_check/typescript_checker 70,140 / 70,140 0% ⚪
Transform
Benchmark Ir (K) Change
transform/excalidraw_app 34,246 / 34,246 −0.001% 🟢
transform/hono_types 12,716 / 12,716 −0.006% 🟢
transform/kitchen_sink 112,544 / 112,547 −0.003% 🟢
transform/radix_ui_adoption 346 / 346 −0.034% 🟢
transform/three 127,191 / 127,191 +0.001% 🔴
transform_v1/excalidraw_app 76,349 / 76,351 −0.002% 🟢
transform_v1/hono_types 593 / 593 −0.054% 🟢
transform_v1/kitchen_sink 146,206 / 146,206 0% ⚪
transform_v1/radix_ui_adoption 612 / 612 −0.011% 🟢
transform_v1/three 240,907 / 240,899 +0.003% 🔴
Type strip
Benchmark Ir (K) Change
astro_config/Part 1 369 / 369 −0.011% 🟢
astro_config/Part 2 158 / 158 0% ⚪
astro_config/Total 527 / 527 −0.008% 🟢
effect_schema_ast/Part 1 2,985 / 2,985 0% ⚪
effect_schema_ast/Part 2 675 / 675 0% ⚪
effect_schema_ast/Total 3,661 / 3,661 0% ⚪
hono_types/Part 1 2,891 / 2,891 −0.001% 🟢
hono_types/Part 2 112 / 112 0% ⚪
hono_types/Total 3,003 / 3,003 −0.001% 🟢
Visit
Benchmark Ir (K) Change
traverse/cal_com_tsx 2,826 / 2,826 0% ⚪
traverse/typescript 25,822 / 25,822 0% ⚪
visit/cal_com_tsx 2,874 / 2,874 0% ⚪
visit/typescript 25,119 / 25,119 0% ⚪
visit_mut/cal_com_tsx 2,555 / 2,555 0% ⚪
visit_mut/typescript 24,288 / 24,288 0% ⚪
Benchmark results
gungraun::parser::bench_parser angular:(ANGULAR, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                    7971944|7971657              (+0.00360%) [+1.00004x]
gungraun::parser::bench_parser backbone:(BACKBONE, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                    1267554|1267593              (-0.00308%) [-1.00003x]
gungraun::parser::bench_parser jquery:(JQUERY, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                    6669090|6668819              (+0.00406%) [+1.00004x]
gungraun::parser::bench_parser jquery_mobile:(JQUERY_MOBILE, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                   10304189|10304129             (+0.00058%) [+1.00001x]
gungraun::parser::bench_parser mootools:(MOOTOOLS, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                    5499990|5499972              (+0.00033%) [+1.00000x]
gungraun::parser::bench_parser underscore:(UNDERSCORE, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                    1131885|1131858              (+0.00239%) [+1.00002x]
gungraun::parser::bench_parser three:(THREE, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                   32274734|32274998             (-0.00082%) [-1.00001x]
gungraun::parser::bench_parser yui:(YUI, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                    5176286|5176318              (-0.00062%) [-1.00001x]
gungraun::parser::bench_parser typescript:(TYPESCRIPT, Lang :: Js)
  Baselines:                                              |base
  Instructions:                                  162356139|162356112            (+0.00002%) [+1.00000x]
gungraun::parser::bench_parser cal_com_tsx:(CAL_COM_TSX, Lang :: Tsx)
  Baselines:                                              |base
  Instructions:                                   25103218|25103498             (-0.00112%) [-1.00001x]
gungraun::parser::bench_parser hono_types:(HONO_TYPES, Lang :: Ts)
  Baselines:                                              |base
  Instructions:                                    2898636|2898683              (-0.00162%) [-1.00002x]
gungraun::parser::bench_markdown_parser biome_readme:(BIOME_README)
  Baselines:                                              |base
  Instructions:                                     316375|316308               (+0.02118%) [+1.00021x]
gungraun::parser::bench_markdown_parser prettier_options:(PRETTIER_OPTIONS)
  Baselines:                                              |base
  Instructions:                                    1600991|1601151              (-0.00999%) [-1.00010x]
gungraun::parser::bench_markdown_parser nix_changelog:(NIX_CHANGELOG)
  Baselines:                                              |base
  Instructions:                                    8110622|8110561              (+0.00075%) [+1.00001x]
gungraun::semantic::bench_analyze typescript:(setup_program(TYPESCRIPT, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                  129368756|129370044            (-0.00100%) [-1.00001x]
gungraun::semantic::bench_analyze cal_com_tsx:(setup_program(CAL_COM_TSX, Lang :: Tsx))
  Baselines:                                              |base
  Instructions:                                   15944622|15945131             (-0.00319%) [-1.00003x]
gungraun::semantic::bench_analyze typescript_checker:(setup_program(TYPESCRIPT_CHECKER, Lang :: Ts))
  Baselines:                                              |base
  Instructions:                                   55504451|55504277             (+0.00031%) [+1.00000x]
gungraun::semantic::bench_syntax_check typescript:(setup_program(TYPESCRIPT, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                  178137117|178137980            (-0.00048%) [-1.00000x]
gungraun::semantic::bench_syntax_check cal_com_tsx:(setup_program(CAL_COM_TSX, Lang :: Tsx))
  Baselines:                                              |base
  Instructions:                                   26798889|26800492             (-0.00598%) [-1.00006x]
gungraun::semantic::bench_syntax_check typescript_checker:(setup_program(TYPESCRIPT_CHECKER, Lang :: Ts))
  Baselines:                                              |base
  Instructions:                                   70140263|70140112             (+0.00022%) [+1.00000x]
gungraun::generator::bench_generate typescript:(setup_generate(TYPESCRIPT, "typescript.js"))
  Baselines:                                              |base
  Instructions:                                  371380669|371380549            (+0.00003%) [+1.00000x]
gungraun::generator::bench_generate cal_com_tsx:(setup_generate(CAL_COM_TSX, "cal.com.tsx"))
  Baselines:                                              |base
  Instructions:                                   49266595|49266242             (+0.00072%) [+1.00001x]
gungraun::formatter::bench_formatter angular:(setup_formatter_program(ANGULAR, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   73453780|73639427             (-0.25210%) [-1.00253x]
gungraun::formatter::bench_formatter backbone:(setup_formatter_program(BACKBONE, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   10975280|11034832             (-0.53967%) [-1.00543x]
gungraun::formatter::bench_formatter jquery_mobile:(setup_formatter_program(JQUERY_MOBILE, Lang :: Js...
  Baselines:                                              |base
  Instructions:                                   94581427|95000681             (-0.44132%) [-1.00443x]
gungraun::formatter::bench_formatter mootools:(setup_formatter_program(MOOTOOLS, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   46805283|47050380             (-0.52092%) [-1.00524x]
gungraun::formatter::bench_formatter underscore:(setup_formatter_program(UNDERSCORE, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                    9821810|9873654              (-0.52507%) [-1.00528x]
gungraun::formatter::bench_formatter three:(setup_formatter_program(THREE, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                  254153730|255137088            (-0.38542%) [-1.00387x]
gungraun::formatter::bench_formatter yui:(setup_formatter_program(YUI, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   46329377|46445990             (-0.25107%) [-1.00252x]
gungraun::formatter::bench_formatter typescript:(setup_formatter_program(TYPESCRIPT, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                 1424108832|1427687024           (-0.25063%) [-1.00251x]
gungraun::formatter::bench_formatter astro_config:(setup_formatter_program(ASTRO_CONFIG, Lang :: Ts)...
  Baselines:                                              |base
  Instructions:                                    4346987|4348503              (-0.03486%) [-1.00035x]
gungraun::formatter::bench_formatter effect_schema_ast:(setup_formatter_program(EFFECT_SCHEMA_AST, Lang :...
  Baselines:                                              |base
  Instructions:                                   23627512|23717670             (-0.38013%) [-1.00382x]
gungraun::formatter::bench_formatter hono_types:(setup_formatter_program(HONO_TYPES, Lang :: Ts))
  Baselines:                                              |base
  Instructions:                                   16025328|16031474             (-0.03834%) [-1.00038x]
gungraun::formatter::bench_markdown_formatter biome_readme:(parse_markdown(BIOME_README))
  Baselines:                                              |base
  Instructions:                                     285414|287109               (-0.59037%) [-1.00594x]
gungraun::formatter::bench_markdown_formatter prettier_options:(parse_markdown(PRETTIER_OPTIONS))
  Baselines:                                              |base
  Instructions:                                    1053820|1062393              (-0.80695%) [-1.00814x]
gungraun::formatter::bench_markdown_formatter nix_changelog:(parse_markdown(NIX_CHANGELOG))
  Baselines:                                              |base
  Instructions:                                    4682101|4706230              (-0.51270%) [-1.00515x]
gungraun::minifier::bench_minifier underscore:(setup_minifier(UNDERSCORE))
  Baselines:                                              |base
  Instructions:                                    2778070|2777841              (+0.00824%) [+1.00008x]
gungraun::minifier::bench_minifier angular:(setup_minifier(ANGULAR))
  Baselines:                                              |base
  Instructions:                                   19087396|19086688             (+0.00371%) [+1.00004x]
gungraun::minifier::bench_minifier typescript:(setup_minifier(TYPESCRIPT))
  Baselines:                                              |base
  Instructions:                                  385745850|385746996            (-0.00030%) [-1.00000x]
gungraun::minifier::bench_minifier semantic:(setup_minifier(MINIFIER_SEMANTIC))
  Baselines:                                              |base
  Instructions:                                      43050|43050                (No change)
gungraun::transform::bench_transform three:(setup_transform(THREE, "three-0.138.3.js"))
  Baselines:                                              |base
  Instructions:                                  127191958|127191136            (+0.00065%) [+1.00001x]
gungraun::transform::bench_transform excalidraw_app:(setup_transform(EXCALIDRAW_APP, "App.tsx"))
  Baselines:                                              |base
  Instructions:                                   34246438|34246665             (-0.00066%) [-1.00001x]
gungraun::transform::bench_transform radix_ui_adoption:(setup_transform(RADIX_UI_ADOPTION, "RadixUIAdopti...
  Baselines:                                              |base
  Instructions:                                     346507|346625               (-0.03404%) [-1.00034x]
gungraun::transform::bench_transform hono_types:(setup_transform(HONO_TYPES, "hono-types.ts"))
  Baselines:                                              |base
  Instructions:                                   12716069|12716830             (-0.00598%) [-1.00006x]
gungraun::transform::bench_transform kitchen_sink:(setup_transform(KITCHEN_SINK, "kitchen-sink.tsx")...
  Baselines:                                              |base
  Instructions:                                  112544954|112547865            (-0.00259%) [-1.00003x]
gungraun::transform::bench_transform_v1 three:(setup_transform_v1(THREE, "three-0.138.3.js"))
  Baselines:                                              |base
  Instructions:                                  240907350|240899804            (+0.00313%) [+1.00003x]
gungraun::transform::bench_transform_v1 excalidraw_app:(setup_transform_v1(EXCALIDRAW_APP, "App.tsx"))
  Baselines:                                              |base
  Instructions:                                   76349708|76351506             (-0.00235%) [-1.00002x]
gungraun::transform::bench_transform_v1 radix_ui_adoption:(setup_transform_v1(RADIX_UI_ADOPTION, "RadixUIAdo...
  Baselines:                                              |base
  Instructions:                                     612330|612398               (-0.01110%) [-1.00011x]
gungraun::transform::bench_transform_v1 hono_types:(setup_transform_v1(HONO_TYPES, "hono-types.ts"))
  Baselines:                                              |base
  Instructions:                                     593186|593506               (-0.05392%) [-1.00054x]
gungraun::transform::bench_transform_v1 kitchen_sink:(setup_transform_v1(KITCHEN_SINK, "kitchen-sink.ts...
  Baselines:                                              |base
  Instructions:                                  146206460|146206071            (+0.00027%) [+1.00000x]
gungraun::type_strip::bench_type_strip astro_config:(ASTRO_CONFIG, type_strip_options(Lang :: Ts))
  ## pid: 5403 thread: 1 part: 1                          |pid: 5328 thread: 1 part: 1
  Command:
                                      /home/runner/work/_temp/gungraun-bin/head/gungraun|/home/runner/work/_temp/gungraun-bin/base/gungraun --gungraun-run d:d:000000 00006 00000 00000
  Baselines:                                              |base
  Instructions:                                     369377|369418               (-0.01110%) [-1.00011x]
  ## pid: 5403 thread: 1 part: 2                          |pid: 5328 thread: 1 part: 2
  Command:
                                      /home/runner/work/_temp/gungraun-bin/head/gungraun|/home/runner/work/_temp/gungraun-bin/base/gungraun --gungraun-run d:d:000000 00006 00000 00000
  Instructions:                                     158362|158362               (No change)
  ## Total
  Instructions:                                     527739|527780               (-0.00777%) [-1.00008x]
gungraun::type_strip::bench_type_strip effect_schema_ast:(EFFECT_SCHEMA_AST, type_strip_options(Lang :: Ts)...
  ## pid: 5404 thread: 1 part: 1                          |pid: 5329 thread: 1 part: 1
  Command:
                                      /home/runner/work/_temp/gungraun-bin/head/gungraun|/home/runner/work/_temp/gungraun-bin/base/gungraun --gungraun-run d:d:000000 00006 00000 00001
  Baselines:                                              |base
  Instructions:                                    2985997|2985998              (-0.00003%) [-1.00000x]
  ## pid: 5404 thread: 1 part: 2                          |pid: 5329 thread: 1 part: 2
  Command:
                                      /home/runner/work/_temp/gungraun-bin/head/gungraun|/home/runner/work/_temp/gungraun-bin/base/gungraun --gungraun-run d:d:000000 00006 00000 00001
  Instructions:                                     675715|675715               (No change)
  ## Total
  Instructions:                                    3661712|3661713              (-0.00003%) [-1.00000x]
gungraun::type_strip::bench_type_strip hono_types:(HONO_TYPES, type_strip_options(Lang :: Ts))
  ## pid: 5405 thread: 1 part: 1                          |pid: 5330 thread: 1 part: 1
  Command:
                                      /home/runner/work/_temp/gungraun-bin/head/gungraun|/home/runner/work/_temp/gungraun-bin/base/gungraun --gungraun-run d:d:000000 00006 00000 00002
  Baselines:                                              |base
  Instructions:                                    2891232|2891267              (-0.00121%) [-1.00001x]
  ## pid: 5405 thread: 1 part: 2                          |pid: 5330 thread: 1 part: 2
  Command:
                                      /home/runner/work/_temp/gungraun-bin/head/gungraun|/home/runner/work/_temp/gungraun-bin/base/gungraun --gungraun-run d:d:000000 00006 00000 00002
  Instructions:                                     112005|112005               (No change)
  ## Total
  Instructions:                                    3003237|3003272              (-0.00117%) [-1.00001x]
gungraun::visit::bench_visit typescript:(setup_program(TYPESCRIPT, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   25119209|25119209             (No change)
gungraun::visit::bench_visit cal_com_tsx:(setup_program(CAL_COM_TSX, Lang :: Tsx))
  Baselines:                                              |base
  Instructions:                                    2874310|2874310              (No change)
gungraun::visit::bench_visit_mut typescript:(setup_program(TYPESCRIPT, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   24288597|24288597             (No change)
gungraun::visit::bench_visit_mut cal_com_tsx:(setup_program(CAL_COM_TSX, Lang :: Tsx))
  Baselines:                                              |base
  Instructions:                                    2555855|2555855              (No change)
gungraun::visit::bench_traverse typescript:(setup_program(TYPESCRIPT, Lang :: Js))
  Baselines:                                              |base
  Instructions:                                   25822582|25822582             (No change)
gungraun::visit::bench_traverse cal_com_tsx:(setup_program(CAL_COM_TSX, Lang :: Tsx))
  Baselines:                                              |base
  Instructions:                                    2826624|2826624              (No change)

Gungraun result: Ok. 59 without regressions; 0 regressed; 0 filtered; 59 benchmarks finished in 89.5379s

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

JavaScript API Gungraun benchmark diff

Base: f6f4151d645e55d9271991b0fbfc87f940ed3197; compare: 72126099c28ca8a0f41d8931ea57d98f26b9fd12

Values are shown as compare / base.

Download the raw Gungraun and Valgrind data (retained for 90 days).

Callgrind metric changes

Median instruction counts from three processes, shown as compare / base in K (1,000), truncated to whole thousands. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged or overlapping ranges (inconclusive).

JIT disabled (--jitless); predictable mode enabled (--predictable). Counts are not wall time. Exact counts, ranges and profiles are retained in artifacts.

Generate
Benchmark Ir (K) Change
underscore_1_5_2_js 416,797 / 416,797 0% ⚪
Lang
Benchmark Ir (K) Change
tsx 26,891 / 26,891 0% ⚪
Parse
Benchmark Ir (K) Change
underscore_1_5_2_js 546,420 / 546,420 0% ⚪
Source type
Benchmark Ir (K) Change
mjs 26,591 / 26,591 0% ⚪
Walk
Benchmark Ir (K) Change
underscore_1_5_2_js 338,758 / 338,758 0% ⚪
Benchmark results

Exact instruction counts: median (min–max).

Benchmark Compare Ir Base Ir Assessment
generate/underscore_1_5_2_js 416797967 (416797967–416797967) 416797967 (416797967–416797967) Inconclusive (ranges overlap)
lang/tsx 26891662 (26891662–26891662) 26891662 (26891662–26891662) Inconclusive (ranges overlap)
parse/underscore_1_5_2_js 546420309 (546420147–546420401) 546420197 (546420135–546420317) Inconclusive (ranges overlap)
source_type/mjs 26591662 (26591662–26591662) 26591662 (26591662–26591662) Inconclusive (ranges overlap)
walk/underscore_1_5_2_js 338758647 (338758647–338758647) 338758647 (338758647–338758647) Inconclusive (ranges overlap)

Highlighted code frames contain escape sequences between source tokens.
Strip them before comparing the reported source line for whole-file and
range formatting.
Specialize JavaScript statement traversal for whole-file sequences
without source-line constraints.

Handle the first selected Markdown block at the range entry point and
render ordinary blocks directly during traversal.
Select the enclosing block when a range touches its braces or contains
only whitespace between its statements. Keep comments outside the edit
and preserve class members when only their indentation is selected.

Handle Prettier range offsets and markers in JS, TS, and Markdown
conformance. Compare the full file after applying each edit and record
the intentional differences in class indentation and line endings.
@magic-akari
magic-akari marked this pull request as ready for review December 4, 2026 14:45
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-04T14:45:45.842347Z
We couldn’t complete this review. Comment @codex review to try again.
cbc8def Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

Include the starting line and column in syntax error messages. Preserve
the full source location on the error for programmatic callers.
Range selections use offsets from the original source. Only whole-file
cases that produce output run a second pass, so use the whole-file
case count as the upper bound for the reported denominator.

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

Development

Successfully merging this pull request may close these issues.

1 participant