Skip to content

feat(minifier): normalize Number.NaN as NaN#11275

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-25-feat_minifier_normalize_number.nan_as_nan_
May 25, 2025
Merged

feat(minifier): normalize Number.NaN as NaN#11275
graphite-app[bot] merged 1 commit intomainfrom
05-25-feat_minifier_normalize_number.nan_as_nan_

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented May 25, 2025

closes #11272

Copilot AI review requested due to automatic review settings May 25, 2025 04:06
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 25, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented May 25, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link
Member Author

Boshen commented May 25, 2025

Merge activity

@github-actions github-actions bot added A-minifier Area - Minifier A-ast Area - AST C-enhancement Category - New feature or request labels May 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR normalizes the representation of NaN by converting both NaN and Number.NaN expressions to a unified f64::NaN.

  • Adds tests to ensure that Number.NaN is normalized to NaN.
  • Updates normalization logic in the minifier to handle Number.NaN alongside NaN.
  • Introduces a helper method in the AST builder to construct a NaN literal.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_minifier/tests/peephole/dead_code_elimination.rs Adds tests for folding Number.NaN to NaN.
crates/oxc_minifier/src/peephole/normalize.rs Updates normalization documentation and adds fold_number_nan_to_nan function; renames convert_void_ident to fold_void_ident.
crates/oxc_ast/src/ast_builder_impl.rs Introduces a new nan() helper function to build a NaN literal.

@codspeed-hq
Copy link

codspeed-hq bot commented May 25, 2025

CodSpeed Instrumentation Performance Report

Merging #11275 will degrade performances by 5.07%

Comparing 05-25-feat_minifier_normalize_number.nan_as_nan_ (f88f666) with main (7f2d660)

Summary

❌ 1 regressions
✅ 37 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[RadixUIAdoptionSection.jsx] 13.6 µs 14.3 µs -5.07%

@Boshen Boshen force-pushed the 05-25-feat_minifier_normalize_number.nan_as_nan_ branch from 8ed6bca to 01ca3de Compare May 25, 2025 05:11
@graphite-app graphite-app bot force-pushed the 05-25-feat_minifier_normalize_number.nan_as_nan_ branch from 01ca3de to f88f666 Compare May 25, 2025 05:19
@graphite-app graphite-app bot merged commit f88f666 into main May 25, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 05-25-feat_minifier_normalize_number.nan_as_nan_ branch May 25, 2025 05:25
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-minifier Area - Minifier C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(minifier): normalize Number.NaN as NaN

2 participants