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

chore: supporting parallelism with rayon #229

Merged
merged 1 commit into from
May 13, 2024
Merged

chore: supporting parallelism with rayon #229

merged 1 commit into from
May 13, 2024

Conversation

gvozdvmozgu
Copy link
Collaborator

No description provided.

@gvozdvmozgu
Copy link
Collaborator Author

gvozdvmozgu commented Apr 23, 2024

PS > Measure-Command { sqruff.exe lint . *> $nul }        


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 194
Ticks             : 11949992
TotalDays         : 1.38310092592593E-05
TotalHours        : 0.000331944222222222
TotalMinutes      : 0.0199166533333333
TotalSeconds      : 1.1949992
TotalMilliseconds : 1194.9992

test files were created using

@echo off
SETLOCAL EnableDelayedExpansion

REM Create a new directory called SqlFolder
mkdir SqlFolder

REM Create the test.sql file with SQL command
echo SELECT * FROM test; > test.sql

REM Duplicate the file 315 times in the SqlFolder
FOR /L %%G IN (1,1,315) DO (
    copy test.sql SqlFolder\test_%%G.sql > NUL
)

REM Clean up the original test.sql
del test.sql

echo Files created successfully.
ENDLOCAL

@gvozdvmozgu gvozdvmozgu marked this pull request as ready for review April 24, 2024 09:13
@gvozdvmozgu gvozdvmozgu marked this pull request as draft April 27, 2024 10:13
@benfdking
Copy link
Collaborator

@gvozdvmozgu did we prove this had the desired effect on performance? I can see your measurement but not really "impact" per se because I have no control?

@gvozdvmozgu
Copy link
Collaborator Author

We have managed to improve performance in single-threaded mode, so I think we can delay introducing multithreading. Since we are currently adding rules that share data through memory in RuleContext, it seems that adding multithreading could potentially cause problems.

@gvozdvmozgu gvozdvmozgu marked this pull request as ready for review May 13, 2024 19:39
@gvozdvmozgu gvozdvmozgu changed the title chore: experiment: supporting parallelism with rayon chore: supporting parallelism with rayon May 13, 2024
@gvozdvmozgu
Copy link
Collaborator Author

ready for review

@benfdking
Copy link
Collaborator

The benchmark goes from 1.19s on my end to 338ms. That is nice!

@benfdking benfdking added this pull request to the merge queue May 13, 2024
Merged via the queue into quarylabs:main with commit d9fb3fe May 13, 2024
6 checks passed
@gvozdvmozgu gvozdvmozgu deleted the rayon branch May 13, 2024 21:58
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.

2 participants