Skip to content

refactor(minifier): prefer is_empty() over len() == 0#10199

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-03-refactor_minifier_prefer_is_empty_over_len_0_
Apr 3, 2025
Merged

refactor(minifier): prefer is_empty() over len() == 0#10199
graphite-app[bot] merged 1 commit intomainfrom
04-03-refactor_minifier_prefer_is_empty_over_len_0_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Apr 3, 2025

Prefer !collection.is_empty() over collection.len() > 0. With some collections, is_empty is more optimized.

Flagged by clippy in Rust 1.86.0.

Copy link
Member Author


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-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Apr 3, 2025
@overlookmotel overlookmotel marked this pull request as ready for review April 3, 2025 11:43
@overlookmotel
Copy link
Member Author

Pure refactor, so merging without review.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Apr 3, 2025
Copy link
Member Author

overlookmotel commented Apr 3, 2025

Merge activity

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 3, 2025

CodSpeed Instrumentation Performance Report

Merging #10199 will degrade performances by 3.3%

Comparing 04-03-refactor_minifier_prefer_is_empty_over_len_0_ (9ffb613) with main (66a0001)

Summary

⚡ 1 improvements
❌ 1 regressions
✅ 34 untouched benchmarks

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

Benchmarks breakdown

Benchmark BASE HEAD Change
formatter[antd.js] 7.9 ms 7.6 ms +3.84%
formatter[typescript.js] 7.2 ms 7.4 ms -3.3%

Prefer `!collection.is_empty()` over `collection.len() > 0`. With some collections, `is_empty` is more optimized.

Flagged by clippy in Rust 1.86.0.
@graphite-app graphite-app bot force-pushed the 04-03-refactor_minifier_prefer_is_empty_over_len_0_ branch from 7c4bb52 to 9ffb613 Compare April 3, 2025 11:50
@graphite-app graphite-app bot merged commit 9ffb613 into main Apr 3, 2025
28 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 3, 2025
@graphite-app graphite-app bot deleted the 04-03-refactor_minifier_prefer_is_empty_over_len_0_ branch April 3, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant