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

divide function is causing huge compile times #144

Open
cameron-yee opened this issue Aug 22, 2022 · 0 comments
Open

divide function is causing huge compile times #144

cameron-yee opened this issue Aug 22, 2022 · 0 comments

Comments

@cameron-yee
Copy link

Description

The divide function in src/util/_unit.scss is causing our SCSS compile times to take about 20 minutes. The divide function takes a long time to run when large numbers are passed in to the $dividend parameter. This doesn't seem to be an issue with the built-in divide function from Sass.

Commit: bde57ece5f18e050ef0fdb51e90b5f97d9fead0a

How to Reproduce

We're calling the strip-unit function with strip-unit(999999999). This calls: divide(999999999, 1).

The nested @while loop on lines 28-31 in the divide function runs 999999999 times which takes a really long time.

The @while loop starts with these values:

$remainder: 999999999;
$divisor: 1;

   @while ($remainder >= $divisor) {
      $remainder: $remainder - $divisor;
      $quotient: $quotient + 1;
    }

Reverting to v2.0.3 fixes this issue.

Motion-UI Version
2.0.4

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

No branches or pull requests

1 participant