Skip to content

Commit

Permalink
fix(css/minifier): Don't tranform rotate deg (#9072)
Browse files Browse the repository at this point in the history
**Description:**

Transform rotate deg will cause animation work differently, so don't do transform for rotate deg

**Related issue:**

 - Closes #9070
  • Loading branch information
hardfist authored Jun 18, 2024
1 parent 071e5be commit 8d37dae
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
12 changes: 0 additions & 12 deletions crates/swc_css_minifier/src/compressor/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ impl Compressor {
return;
}

let deg = normalize_deg(deg);

angle.value = Number {
value: deg,
raw: None,
Expand All @@ -52,13 +50,3 @@ impl Compressor {
};
}
}

fn normalize_deg(mut value: f64) -> f64 {
value = (value % 360.0 + 360.0) % 360.0;

if value > 350.0 {
return value - 360.0;
}

value
}
Loading

1 comment on commit 8d37dae

@github-actions
Copy link

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 8d37dae Previous: c3a8c0b Ratio
es/full/bugs-1 277035 ns/iter (± 9745) 298404 ns/iter (± 7389) 0.93
es/full/minify/libraries/antd 1804690285 ns/iter (± 82243333) 1776794993 ns/iter (± 85834534) 1.02
es/full/minify/libraries/d3 344737502 ns/iter (± 9070701) 340009579 ns/iter (± 1198619) 1.01
es/full/minify/libraries/echarts 1521118312 ns/iter (± 66540902) 1448185177 ns/iter (± 57215045) 1.05
es/full/minify/libraries/jquery 102428483 ns/iter (± 312032) 102620388 ns/iter (± 328948) 1.00
es/full/minify/libraries/lodash 113806455 ns/iter (± 267875) 114180397 ns/iter (± 210575) 1.00
es/full/minify/libraries/moment 59350212 ns/iter (± 71166) 59497708 ns/iter (± 113926) 1.00
es/full/minify/libraries/react 18401577 ns/iter (± 47146) 18440265 ns/iter (± 34169) 1.00
es/full/minify/libraries/terser 270510899 ns/iter (± 1244541) 273836591 ns/iter (± 812847) 0.99
es/full/minify/libraries/three 481796701 ns/iter (± 17971792) 465472623 ns/iter (± 1926269) 1.04
es/full/minify/libraries/typescript 3399090723 ns/iter (± 53757027) 3307073236 ns/iter (± 66794527) 1.03
es/full/minify/libraries/victory 783112330 ns/iter (± 16890649) 778814392 ns/iter (± 41362395) 1.01
es/full/minify/libraries/vue 147680937 ns/iter (± 1418083) 146983765 ns/iter (± 1449861) 1.00
es/full/codegen/es3 60763 ns/iter (± 1089) 59683 ns/iter (± 500) 1.02
es/full/codegen/es5 61385 ns/iter (± 390) 59802 ns/iter (± 544) 1.03
es/full/codegen/es2015 60837 ns/iter (± 304) 59643 ns/iter (± 837) 1.02
es/full/codegen/es2016 60838 ns/iter (± 245) 59363 ns/iter (± 225) 1.02
es/full/codegen/es2017 60582 ns/iter (± 174) 59922 ns/iter (± 486) 1.01
es/full/codegen/es2018 60492 ns/iter (± 174) 59558 ns/iter (± 251) 1.02
es/full/codegen/es2019 60474 ns/iter (± 174) 59539 ns/iter (± 292) 1.02
es/full/codegen/es2020 60667 ns/iter (± 250) 59522 ns/iter (± 258) 1.02
es/full/all/es3 164199198 ns/iter (± 815136) 163304623 ns/iter (± 863134) 1.01
es/full/all/es5 158540261 ns/iter (± 937376) 157410189 ns/iter (± 944630) 1.01
es/full/all/es2015 117812222 ns/iter (± 571769) 117606130 ns/iter (± 657633) 1.00
es/full/all/es2016 117501845 ns/iter (± 850302) 116507800 ns/iter (± 731290) 1.01
es/full/all/es2017 117833220 ns/iter (± 979558) 116006693 ns/iter (± 405918) 1.02
es/full/all/es2018 114774323 ns/iter (± 1048761) 113359110 ns/iter (± 1290446) 1.01
es/full/all/es2019 113662279 ns/iter (± 802152) 113166007 ns/iter (± 880351) 1.00
es/full/all/es2020 109349246 ns/iter (± 1689164) 108889352 ns/iter (± 901090) 1.00
es/full/parser 478507 ns/iter (± 2107) 471641 ns/iter (± 3575) 1.01
es/full/base/fixer 15529 ns/iter (± 65) 15396 ns/iter (± 84) 1.01
es/full/base/resolver_and_hygiene 78810 ns/iter (± 147) 80207 ns/iter (± 1059) 0.98
serialization of serde 271 ns/iter (± 0) 283 ns/iter (± 5) 0.96
css/minify/libraries/bootstrap 21799879 ns/iter (± 44977) 22138820 ns/iter (± 159663) 0.98
css/visitor/compare/clone 1399582 ns/iter (± 9733) 1386424 ns/iter (± 8019) 1.01
css/visitor/compare/visit_mut_span 1524233 ns/iter (± 7072) 1513463 ns/iter (± 3707) 1.01
css/visitor/compare/visit_mut_span_panic 1546686 ns/iter (± 37397) 1528328 ns/iter (± 27601) 1.01
css/visitor/compare/fold_span 2047249 ns/iter (± 20276) 2041419 ns/iter (± 7657) 1.00
css/visitor/compare/fold_span_panic 2170515 ns/iter (± 4677) 2177620 ns/iter (± 21379) 1.00
css/lexer/bootstrap_5_1_3 3450234 ns/iter (± 5488) 3456385 ns/iter (± 39317) 1.00
css/lexer/foundation_6_7_4 2794727 ns/iter (± 1520) 2796930 ns/iter (± 3929) 1.00
css/lexer/tailwind_3_1_1 536658 ns/iter (± 2578) 538937 ns/iter (± 775) 1.00
css/parser/bootstrap_5_1_3 16255982 ns/iter (± 153549) 16545483 ns/iter (± 137019) 0.98
css/parser/foundation_6_7_4 12935355 ns/iter (± 24652) 13124173 ns/iter (± 119272) 0.99
css/parser/tailwind_3_1_1 2565061 ns/iter (± 8484) 2550064 ns/iter (± 3689) 1.01
es/codegen/colors 736477 ns/iter (± 404546) 728851 ns/iter (± 397041) 1.01
es/codegen/large 3025568 ns/iter (± 1587788) 2983940 ns/iter (± 1625054) 1.01
es/codegen/with-parser/colors 43233 ns/iter (± 292) 42861 ns/iter (± 752) 1.01
es/codegen/with-parser/large 462204 ns/iter (± 61624) 463201 ns/iter (± 4098) 1.00
es/minify/libraries/antd 1370765257 ns/iter (± 15795786) 1513500764 ns/iter (± 25599337) 0.91
es/minify/libraries/d3 275719132 ns/iter (± 5503562) 288267559 ns/iter (± 7617598) 0.96
es/minify/libraries/echarts 1108821151 ns/iter (± 11860711) 1240120004 ns/iter (± 21590249) 0.89
es/minify/libraries/jquery 82021144 ns/iter (± 853444) 82730473 ns/iter (± 266598) 0.99
es/minify/libraries/lodash 103336731 ns/iter (± 1344519) 105214327 ns/iter (± 419612) 0.98
es/minify/libraries/moment 47431118 ns/iter (± 579074) 48489880 ns/iter (± 312850) 0.98
es/minify/libraries/react 15976878 ns/iter (± 157213) 16217688 ns/iter (± 105146) 0.99
es/minify/libraries/terser 216035688 ns/iter (± 2453830) 220720334 ns/iter (± 2242913) 0.98
es/minify/libraries/three 354490600 ns/iter (± 2658228) 378929763 ns/iter (± 11942029) 0.94
es/minify/libraries/typescript 2633829248 ns/iter (± 19594187) 2790346985 ns/iter (± 33552215) 0.94
es/minify/libraries/victory 556557331 ns/iter (± 6561665) 619834605 ns/iter (± 12233761) 0.90
es/minify/libraries/vue 119782951 ns/iter (± 879775) 121795427 ns/iter (± 649642) 0.98
es/visitor/compare/clone 1714598 ns/iter (± 9302) 1696722 ns/iter (± 5310) 1.01
es/visitor/compare/visit_mut_span 2064260 ns/iter (± 13014) 2042908 ns/iter (± 10336) 1.01
es/visitor/compare/visit_mut_span_panic 2067993 ns/iter (± 50917) 2042237 ns/iter (± 28066) 1.01
es/visitor/compare/fold_span 2782852 ns/iter (± 6447) 2776874 ns/iter (± 11132) 1.00
es/visitor/compare/fold_span_panic 2807009 ns/iter (± 4153) 2812427 ns/iter (± 20426) 1.00
es/lexer/colors 10525 ns/iter (± 100) 10691 ns/iter (± 85) 0.98
es/lexer/angular 5203174 ns/iter (± 18272) 5534263 ns/iter (± 28585) 0.94
es/lexer/backbone 635834 ns/iter (± 6798) 655838 ns/iter (± 4645) 0.97
es/lexer/jquery 3645453 ns/iter (± 5430) 3915086 ns/iter (± 19192) 0.93
es/lexer/jquery mobile 5436796 ns/iter (± 25951) 5815009 ns/iter (± 16885) 0.93
es/lexer/mootools 2874676 ns/iter (± 5542) 3052463 ns/iter (± 10752) 0.94
es/lexer/underscore 528023 ns/iter (± 897) 563484 ns/iter (± 1971) 0.94
es/lexer/three 16431791 ns/iter (± 25597) 17109930 ns/iter (± 133284) 0.96
es/lexer/yui 2960107 ns/iter (± 45250) 3015053 ns/iter (± 29154) 0.98
es/lexer/cal-com 13774546 ns/iter (± 34933) 13918241 ns/iter (± 67615) 0.99
es/lexer/typescript 92063742 ns/iter (± 353648) 94039195 ns/iter (± 1370052) 0.98
es/parser/colors 25619 ns/iter (± 390) 25309 ns/iter (± 111) 1.01
es/parser/angular 13057905 ns/iter (± 71423) 12846321 ns/iter (± 74576) 1.02
es/parser/backbone 1883258 ns/iter (± 5608) 1860392 ns/iter (± 11844) 1.01
es/parser/jquery 10397346 ns/iter (± 56802) 10302454 ns/iter (± 65260) 1.01
es/parser/jquery mobile 15591656 ns/iter (± 155626) 15480345 ns/iter (± 99111) 1.01
es/parser/mootools 8104549 ns/iter (± 18293) 8012240 ns/iter (± 28885) 1.01
es/parser/underscore 1645569 ns/iter (± 5974) 1639893 ns/iter (± 8571) 1.00
es/parser/three 45139357 ns/iter (± 179561) 45414497 ns/iter (± 460074) 0.99
es/parser/yui 7719495 ns/iter (± 120135) 7615016 ns/iter (± 42554) 1.01
es/parser/cal-com 42047951 ns/iter (± 548082) 42831274 ns/iter (± 639576) 0.98
es/parser/typescript 277886832 ns/iter (± 1058621) 277522985 ns/iter (± 1277989) 1.00
es/preset-env/usage/builtin_type 136803 ns/iter (± 34061) 135538 ns/iter (± 33325) 1.01
es/preset-env/usage/property 16062 ns/iter (± 61) 16039 ns/iter (± 92) 1.00
es/resolver/typescript 102543741 ns/iter (± 2714845) 102309416 ns/iter (± 3037993) 1.00
es/fixer/typescript 82748494 ns/iter (± 5129072) 80536188 ns/iter (± 3452806) 1.03
es/hygiene/typescript 181395358 ns/iter (± 2821564) 180336595 ns/iter (± 3601611) 1.01
es/resolver_with_hygiene/typescript 308797414 ns/iter (± 10299784) 304889774 ns/iter (± 3959176) 1.01
es/visitor/base-perf/module_clone 54880 ns/iter (± 895) 55652 ns/iter (± 522) 0.99
es/visitor/base-perf/fold_empty 58689 ns/iter (± 1701) 59116 ns/iter (± 648) 0.99
es/visitor/base-perf/fold_noop_impl_all 58721 ns/iter (± 931) 58932 ns/iter (± 1376) 1.00
es/visitor/base-perf/fold_noop_impl_vec 58802 ns/iter (± 397) 59112 ns/iter (± 829) 0.99
es/visitor/base-perf/boxing_boxed_clone 59 ns/iter (± 0) 63 ns/iter (± 2) 0.94
es/visitor/base-perf/boxing_unboxed_clone 47 ns/iter (± 0) 47 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 105 ns/iter (± 0) 106 ns/iter (± 0) 0.99
es/visitor/base-perf/boxing_unboxed 81 ns/iter (± 1) 80 ns/iter (± 0) 1.01
es/visitor/base-perf/visit_contains_this 2629 ns/iter (± 8) 2597 ns/iter (± 12) 1.01
es/base/parallel/resolver/typescript 2496079973 ns/iter (± 163165691) 2436017107 ns/iter (± 72836518) 1.02
es/base/parallel/hygiene/typescript 3270888790 ns/iter (± 56325188) 3139457241 ns/iter (± 61243789) 1.04
babelify-only 474807 ns/iter (± 2491) 478735 ns/iter (± 3149) 0.99
parse_and_babelify_angular 44084664 ns/iter (± 2872176) 45531651 ns/iter (± 1604539) 0.97
parse_and_babelify_backbone 4374860 ns/iter (± 40841) 4568744 ns/iter (± 136873) 0.96
parse_and_babelify_jquery 28012504 ns/iter (± 241713) 30799783 ns/iter (± 807998) 0.91
parse_and_babelify_jquery_mobile 49529735 ns/iter (± 492575) 52077767 ns/iter (± 606159) 0.95
parse_and_babelify_mootools 25278496 ns/iter (± 223889) 27603262 ns/iter (± 366593) 0.92
parse_and_babelify_underscore 3702084 ns/iter (± 24659) 3758173 ns/iter (± 50246) 0.99
parse_and_babelify_yui 24709393 ns/iter (± 410820) 25805334 ns/iter (± 450343) 0.96
html/minify/document/css_spec 47865716 ns/iter (± 753030) 45443479 ns/iter (± 175720) 1.05
html/minify/document/github 19357256 ns/iter (± 201163) 18191952 ns/iter (± 411843) 1.06
html/minify/document/stackoverflow 17752589 ns/iter (± 440772) 16698712 ns/iter (± 561420) 1.06
html/minify/document_fragment/css_spec 46633632 ns/iter (± 956129) 43941909 ns/iter (± 81582) 1.06
html/minify/document_fragment/github 18836341 ns/iter (± 134581) 17770515 ns/iter (± 19087) 1.06
html/minify/document_fragment/stackoverflow 17362952 ns/iter (± 255607) 16273228 ns/iter (± 12522) 1.07
html/document/visitor/compare/clone 163133 ns/iter (± 1138) 165338 ns/iter (± 2596) 0.99
html/document/visitor/compare/visit_mut_span 178565 ns/iter (± 873) 182918 ns/iter (± 631) 0.98
html/document/visitor/compare/visit_mut_span_panic 186317 ns/iter (± 3766) 189903 ns/iter (± 5648) 0.98
html/document/visitor/compare/fold_span 229132 ns/iter (± 815) 231199 ns/iter (± 656) 0.99
html/document/visitor/compare/fold_span_panic 276867 ns/iter (± 832) 283812 ns/iter (± 1416) 0.98
html/document_fragment/visitor/compare/clone 166072 ns/iter (± 1064) 170277 ns/iter (± 947) 0.98
html/document_fragment/visitor/compare/visit_mut_span 180606 ns/iter (± 881) 185527 ns/iter (± 1369) 0.97
html/document_fragment/visitor/compare/visit_mut_span_panic 185593 ns/iter (± 757) 190603 ns/iter (± 1847) 0.97
html/document_fragment/visitor/compare/fold_span 229658 ns/iter (± 872) 229256 ns/iter (± 950) 1.00
html/document_fragment/visitor/compare/fold_span_panic 279630 ns/iter (± 796) 284213 ns/iter (± 723) 0.98
html/lexer/css_2021_spec 12944455 ns/iter (± 489875) 13011994 ns/iter (± 33124) 0.99
html/lexer/github_com_17_05_2022 4969135 ns/iter (± 7662) 4981924 ns/iter (± 11618) 1.00
html/lexer/stackoverflow_com_17_05_2022 4674088 ns/iter (± 6629) 4737239 ns/iter (± 6519) 0.99
html/parser/parser_document/css_2021_spec 25095240 ns/iter (± 136707) 25436241 ns/iter (± 58674) 0.99
html/parser/parser_document/github_com_17_05_2022 8474088 ns/iter (± 7406) 8486533 ns/iter (± 40552) 1.00
html/parser/parser_document/stackoverflow_com_17_05_2022 7440349 ns/iter (± 14671) 7351350 ns/iter (± 9532) 1.01
html/parser/parser_document_fragment/css_2021_spec 24713607 ns/iter (± 111936) 25043667 ns/iter (± 116284) 0.99
html/parser/parser_document_fragment/github_com_17_05_2022 8373709 ns/iter (± 61956) 8443954 ns/iter (± 13464) 0.99
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022 7266244 ns/iter (± 14730) 7294208 ns/iter (± 5476) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.