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

Run the tests in parallel #771

Merged
merged 2 commits into from
May 20, 2024
Merged

Run the tests in parallel #771

merged 2 commits into from
May 20, 2024

Conversation

chasenlehara
Copy link
Member

@chasenlehara chasenlehara commented May 18, 2024

This improves the time it takes to run the exercise solution tests by running them in parallel.

Below are the results of multiple test runs in GitHub and on a MacBook Pro. It looks like about three tests running in parallel is optimal in both environments, so the test script will max out at running three tests at a time.

First run in GitHub CI:

┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 4     │ 787608.631378 │ '13:07.608' │
│ 1       │ 3     │ 461751.497619 │ '7:41.751'  │
│ 2       │ 2     │ 475695.005603 │ '7:55.695'  │
│ 3       │ 1     │ 646006.242796 │ '10:46.006' │
└─────────┴───────┴───────────────┴─────────────┘

Second run (after changing the max limit after realizing the first run will be slower while priming the npm cache):

┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 5     │ 763990.330012 │ '12:43.990' │
│ 1       │ 4     │ 432908.429822 │ '7:12.908'  │
│ 2       │ 3     │ 445064.747047 │ '7:25.064'  │
│ 3       │ 2     │ 468414.323292 │ '7:48.414'  │
│ 4       │ 1     │ 639965.18994  │ '10:39.965' │
└─────────┴───────┴───────────────┴─────────────┘

First run on a MacBook Pro:

┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 8     │ 666539.938417 │ '11:06.539' │
│ 1       │ 7     │ 607849.072083 │ '10:07.849' │
│ 2       │ 6     │ 571706.310166 │ '9:31.706'  │
│ 3       │ 5     │ 516670.640167 │ '8:36.670'  │
│ 4       │ 4     │ 498700.136167 │ '8:18.700'  │
│ 5       │ 3     │ 471225.195584 │ '7:51.225'  │
│ 6       │ 2     │ 485589.121083 │ '8:05.589'  │
│ 7       │ 1     │ 617190.439583 │ '10:17.190' │
└─────────┴───────┴───────────────┴─────────────┘

Second run:

┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 8     │ 653896.0615   │ '10:53.896' │
│ 1       │ 7     │ 578432.966958 │ '9:38.432'  │
│ 2       │ 6     │ 550287.004208 │ '9:10.287'  │
│ 3       │ 5     │ 509471.244167 │ '8:29.471'  │
│ 4       │ 4     │ 497503.24975  │ '8:17.503'  │
│ 5       │ 3     │ 468895.376833 │ '7:48.895'  │
│ 6       │ 2     │ 492863.924542 │ '8:12.863'  │
│ 7       │ 1     │ 615069.0665   │ '10:15.069' │
└─────────┴───────┴───────────────┴─────────────┘

@chasenlehara chasenlehara force-pushed the parallel branch 5 times, most recently from 940228f to d2cf657 Compare May 18, 2024 23:33
This improves the time it takes to run the exercise solution tests by running them in parallel.

Below are the results of multiple test runs in GitHub and on a MacBook Pro. It looks like about three tests running in parallel is optimal in both environments, so the `test` script will max out at running three tests at a time.

First run in GitHub CI:

```
┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 4     │ 787608.631378 │ '13:07.608' │
│ 1       │ 3     │ 461751.497619 │ '7:41.751'  │
│ 2       │ 2     │ 475695.005603 │ '7:55.695'  │
│ 3       │ 1     │ 646006.242796 │ '10:46.006' │
└─────────┴───────┴───────────────┴─────────────┘
```

Second run (after changing the max limit after realizing the first run will be slower while priming the npm cache):

```
┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 5     │ 763990.330012 │ '12:43.990' │
│ 1       │ 4     │ 432908.429822 │ '7:12.908'  │
│ 2       │ 3     │ 445064.747047 │ '7:25.064'  │
│ 3       │ 2     │ 468414.323292 │ '7:48.414'  │
│ 4       │ 1     │ 639965.18994  │ '10:39.965' │
└─────────┴───────┴───────────────┴─────────────┘
```

First run on a MacBook Pro:

```
┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 8     │ 666539.938417 │ '11:06.539' │
│ 1       │ 7     │ 607849.072083 │ '10:07.849' │
│ 2       │ 6     │ 571706.310166 │ '9:31.706'  │
│ 3       │ 5     │ 516670.640167 │ '8:36.670'  │
│ 4       │ 4     │ 498700.136167 │ '8:18.700'  │
│ 5       │ 3     │ 471225.195584 │ '7:51.225'  │
│ 6       │ 2     │ 485589.121083 │ '8:05.589'  │
│ 7       │ 1     │ 617190.439583 │ '10:17.190' │
└─────────┴───────┴───────────────┴─────────────┘
```

Second run:

```
┌─────────┬───────┬───────────────┬─────────────┐
│ (index) │ limit │ time          │ formatted   │
├─────────┼───────┼───────────────┼─────────────┤
│ 0       │ 8     │ 653896.0615   │ '10:53.896' │
│ 1       │ 7     │ 578432.966958 │ '9:38.432'  │
│ 2       │ 6     │ 550287.004208 │ '9:10.287'  │
│ 3       │ 5     │ 509471.244167 │ '8:29.471'  │
│ 4       │ 4     │ 497503.24975  │ '8:17.503'  │
│ 5       │ 3     │ 468895.376833 │ '7:48.895'  │
│ 6       │ 2     │ 492863.924542 │ '8:12.863'  │
│ 7       │ 1     │ 615069.0665   │ '10:15.069' │
└─────────┴───────┴───────────────┴─────────────┘
```
@DanDaManTran
Copy link
Contributor

Screenshot 2024-05-20 at 10 48 51 AM

Test is failing when running benchmark. It pass successfully without benchmark

@chasenlehara
Copy link
Member Author

Test is failing when running benchmark. It pass successfully without benchmark

Interesting, I ran into this too at parallel limits 9+ (my Mac as 10 cores). I don’t think this matters for merging it in because I left the benchmark code mainly as a reference for doing something similar in the future.

@chasenlehara chasenlehara merged commit 73b3e63 into main May 20, 2024
1 check passed
@chasenlehara chasenlehara deleted the parallel branch May 20, 2024 17:40
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

Successfully merging this pull request may close these issues.

None yet

2 participants