Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rolldown): introduce rolldown_rayon #846

Merged
merged 2 commits into from
Apr 13, 2024

Conversation

Brooooooklyn
Copy link
Contributor

Description

Introduce rolldown_rayon crate to make it easier to write rayon code on the non-rayon supported platforms.

Copy link
Contributor Author

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

Join @Brooooooklyn and the rest of your teammates on Graphite Graphite

@Brooooooklyn Brooooooklyn requested a review from hyf0 April 13, 2024 08:46
Copy link

netlify bot commented Apr 13, 2024

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 9e729a8
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/661a475d5d81450008d45a7c

@Brooooooklyn Brooooooklyn force-pushed the 04-13-feat_rolldown_introduce_rolldown_rayon branch from 8143045 to 6fdbf8f Compare April 13, 2024 08:48
Copy link

codecov bot commented Apr 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.52%. Comparing base (9a569ac) to head (f0fd95d).

❗ Current head f0fd95d differs from pull request most recent head 9e729a8. Consider uploading reports for the commit 9e729a8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #846      +/-   ##
==========================================
- Coverage   80.65%   80.52%   -0.14%     
==========================================
  Files         133      133              
  Lines        6731     6685      -46     
==========================================
- Hits         5429     5383      -46     
  Misses       1302     1302              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Brooooooklyn Brooooooklyn force-pushed the 04-13-feat_rolldown_introduce_rolldown_rayon branch from 6fdbf8f to f0fd95d Compare April 13, 2024 08:49
@hyf0
Copy link
Member

hyf0 commented Apr 13, 2024

hhh. I was writing macros about this. I guess they are the same.

@Brooooooklyn
Copy link
Contributor Author

macro can always produce better performance because it outputs the optimized codes in the compile stage.
traits don't affect the compile performance if the lto is off. And it can produce the same optimized codes during lto.
IMO, utilizing traits generally makes our code more readable.

Copy link

codspeed-hq bot commented Apr 13, 2024

CodSpeed Performance Report

Merging #846 will not alter performance

Comparing 04-13-feat_rolldown_introduce_rolldown_rayon (9e729a8) with main (9a569ac)

Summary

✅ 6 untouched benchmarks

@Brooooooklyn Brooooooklyn merged commit 4f9ae49 into main Apr 13, 2024
19 checks passed
@Brooooooklyn Brooooooklyn deleted the 04-13-feat_rolldown_introduce_rolldown_rayon branch April 13, 2024 09:04
@hyf0
Copy link
Member

hyf0 commented Apr 13, 2024

Let's merge it first. I want to do some changes after mering.

  1. move code to rolldown_utils. We might release rust crates in the futurue. It's kind of not worth to have a single crate to do it.
  2. Rename par_iter to maybe_par_iter to show the they might not run in parallel under the hood. Especially we might introduce some logic to decide if we want to eanble parallel even in not(wasm) platform.

Something like swc did in

  ($name:ident.into_iter().$operator:ident($($rest:expr)*), $threshold:expr) => {
      if $name.len() >= $threshold {
          use rayon::prelude::*;
          $name.into_par_iter().$operator($($rest)*)
      } else {
          $name.into_iter().$operator($($rest)*)
      }
  };

@hyf0
Copy link
Member

hyf0 commented Apr 13, 2024

Reminds of oxc_sourcemap enable rayon by default. Just a notice @Brooooooklyn if these's problem of it, you could disable sourcemap generatetion as workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants