Skip to content

feat(minifier): annotate more pure constructors#11555

Merged
graphite-app[bot] merged 1 commit intomainfrom
06-08-feat_minifier_annotate_more_pure_constructors
Jun 9, 2025
Merged

feat(minifier): annotate more pure constructors#11555
graphite-app[bot] merged 1 commit intomainfrom
06-08-feat_minifier_annotate_more_pure_constructors

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jun 8, 2025

closes rolldown/rolldown#2603

I used the following script to capture what argument throws.

function x(F) {
    try {
    new F(null)
    } catch (e) {
        console.log(F.name)
    }
}
x(Set)
x(Map)
x(WeakSet)
x(WeakMap)
x(AggregateError)
x(Boolean)
x(DataView)
x(Error)
x(EvalError)
x(RangeError)
x(ReferenceError)
x(RegExp)
x(SyntaxError)
x(TypeError)
x(URIError)
x(ArrayBuffer)
x(Date)
x(Number)
x(Object)
x(String)

Copy link
Member Author

Boshen commented Jun 8, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-minifier Area - Minifier C-enhancement Category - New feature or request labels Jun 8, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Jun 8, 2025

CodSpeed Instrumentation Performance Report

Merging #11555 will improve performances by 16.71%

Comparing 06-08-feat_minifier_annotate_more_pure_constructors (40ac186) with main (4b76410)

Summary

⚡ 1 improvements
✅ 37 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[cal.com.tsx] 3.5 ms 3 ms +16.71%

@Boshen Boshen marked this pull request as draft June 8, 2025 15:33
@Boshen Boshen force-pushed the 06-08-feat_minifier_annotate_more_pure_constructors branch from 8c0ffde to 4188901 Compare June 8, 2025 16:01
@sapphi-red
Copy link
Member

Some cases you may need to consider:

new ArrayBuffer(-1)
new RegExp("(")

@Boshen
Copy link
Member Author

Boshen commented Jun 9, 2025

Some cases you may need to consider:

new ArrayBuffer(-1)
new RegExp("(")

It seems like Rollup don't care :-) I think there are no real-world cases for these invalid inputs ... so I'll pass as well.

@Boshen Boshen marked this pull request as ready for review June 9, 2025 07:01
@Boshen Boshen marked this pull request as draft June 9, 2025 07:01
@graphite-app
Copy link
Contributor

graphite-app bot commented Jun 9, 2025

Merge activity

@Boshen Boshen marked this pull request as ready for review June 9, 2025 08:25
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jun 9, 2025
closes rolldown/rolldown#2603

I used the following script to capture what argument throws.

```js
function x(F) {
    try {
    new F(null)
    } catch (e) {
        console.log(F.name)
    }
}
x(Set)
x(Map)
x(WeakSet)
x(WeakMap)
x(AggregateError)
x(Boolean)
x(DataView)
x(Error)
x(EvalError)
x(RangeError)
x(ReferenceError)
x(RegExp)
x(SyntaxError)
x(TypeError)
x(URIError)
x(ArrayBuffer)
x(Date)
x(Number)
x(Object)
x(String)
```
@graphite-app graphite-app bot force-pushed the 06-08-feat_minifier_annotate_more_pure_constructors branch from 4188901 to 40ac186 Compare June 9, 2025 08:25
@graphite-app graphite-app bot merged commit 40ac186 into main Jun 9, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 06-08-feat_minifier_annotate_more_pure_constructors branch June 9, 2025 08:32
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: rolldown does not treat builtin object constructors like new Map as sideeffect free

2 participants