-
Notifications
You must be signed in to change notification settings - Fork 701
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
Files regex processing boost #3953
Files regex processing boost #3953
Conversation
Here is some test measurements on 6k files packInitial version
AsParallel only optimization
AsParallel + Regex lazy quantifier
|
NuGet/Home#5706 another related defect. Must be fixed as well because of used regex for home directory |
@BlackGad |
Added some fixes to existing unit tests because AsParallel linq method not guaranty result order. |
Done |
@erdembayar Is everything ok with PR template checklist? |
Any progress? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good overall, and I appreciate the benchmarks, which look awesome! I think you missed a spot, but this otherwise looks fine :) Thank you!
@BlackGad Here is official Here is For the sake of completeness I measured other 2 |
@erdembayar what did exactly you test? Example and benchmarks: Current directory: "C:\" NuGet Version: 5.8.1.7021PS command line Measure-Command -Expression {NuGet pack "C:\1\Test.nuspec" -OutputDirectory c:\temp\ -Version 1.0.0} Result
PS command line Measure-Command -Expression {NuGet pack "C:\Temp\tests\111111\222222\33333\44444\Test.nuspec" -OutputDirectory c:\temp\ -Version 1.0.1} Result
Patched NuGetPS command line Measure-Command -Expression {C:\Projects\GitHub\BlackGad\NuGet.Client\artifacts\NuGet.CommandLine\16.0\bin\Debug\net472\NuGet.exe pack "C:\1\Test.nuspec" -OutputDirectory c:\temp\ -Version 2.0.0} Result
PS command line Measure-Command -Expression {C:\Projects\GitHub\BlackGad\NuGet.Client\artifacts\NuGet.CommandLine\16.0\bin\Debug\net472\NuGet.exe pack "C:\Temp\tests\111111\222222\33333\44444\Test.nuspec" -OutputDirectory c:\temp\ -Version 2.0.1} Result
Comparison table:
This regex fix boost performance even in best cases for current 5.8.1 version also deep nested folder structure is not affect performance so hard. |
Forget to attach test data Create 2 files in target folder: package.json {
"name": "tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/debug": "^4.1.5",
"@types/jquery": "^3.3.38",
"@types/node": "^8.0.14",
"@types/yargs": "^15.0.4",
"typescript": "^3.2.2"
},
"dependencies": {
"debug": "^4.1.1",
"node-red": "^1.2.6",
"yargs": "^15.3.0"
}
} Test.nuspec <?xml version="1.0"?>
<package>
<metadata>
<id>Test</id>
<version>$version$</version>
<authors>Volodymyr Shkolka</authors>
<owners>Volodymyr Shkolka</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Test node-RED npm package pack</description>
</metadata>
<files>
<file src="node_modules\**\*" target="libs\native\node_modules" exclude="**\*.pdb;**\*.obj;**\*.ilk;node_modules\typescript\**\*;node_modules\@types\**\*"/>
</files>
</package> Then in this folder call
After that you are ready to pack NuGet with nuspec specification |
@BlackGad |
@zkat @kartheekp-ms @dtivel |
Can you share me build details? |
@BlackGad |
Added exclude pattern TPL provessing Fixed linq lazy regex objects spawn
Reverted comments formatting
32065ea
to
072a39c
Compare
Rebased. We have 8 hours time difference. For me to have a possibility to react during your working day, please write in the morning ) |
Btw are there any plans to make tests build log accessible to contributors? It would be great feature for faster interaction without involving your team. |
Ok what is Build_and_UnitTest_RTM and what's going wrong with nix systems? TPL or regex? |
Fixed nix and network windows systems regex (nix system absolute path starts with /, windows network path starts with \\ which were not matched with new regex)
Figured out errors. Fixed several unit tests because of incorrect assertion (relay on initial files ordering but AsParallel not guaranty it) Same may happen in windows systems for network pathes which starts from |
@zkat could you review changes and rerun tests? :) |
test/NuGet.Core.Tests/NuGet.Packaging.Test/PackageBuilderTest.cs
Outdated
Show resolved
Hide resolved
…rdingly to review request
Last build failed at NuGet.Client-PrivateDev. @zkat can you provide more details? |
@BlackGad it was a hiccup. Should be fine once I rerun. And yes, I agree that this isn't a great situation re: CI. Thanks for your patience. |
:( again failed. @zkat Could you please provide details? |
Flaky test. I'll rerun it when the rest succeed. |
Bad luck or something was broken? |
rerunning now. It was just a hiccup. Sometimes we have to retry CI a few times before it actually works :( |
:( so unstable. I hoped situation become better from my last PR. I guess this side of nuget is closed for external contributors. Am I wrong? |
no, it's just that since part of what we do HAS to be internal (because we insert stuff into VS itself), and for historical reasons, it's kinda tricky for us to have public CI. This definitely causes friction, though. |
Well, integration parts with VS understandable but missing logs from build and basic unit test results on different platforms make me truly upset. As well as nix platform build and test instructions. We spent for 3 days because of this) Anyway hope you will solve this in future |
We're actually actively working on this! It just takes time and there's a lot of internal resources we still use, and we need to stop doing that before CI can become public. But rest assured, it's coming. Thank you for bearing with us in the meantime. I'm keeping an eye on this build and things seem to be going ok so far. It's just those two flaky jobs running again. |
Yeah it would really make it easier to contribute! I am just trying to fix things that interferes me in my projects) Thank you :) |
yay! We're green! Thanks so much for the contribution :) |
Yay! You are welcome! |
Changed recursive wildcards regex pattern to faster form
Added exclude pattern TPL provessing
Fixed linq lazy regex objects spawn
Bug
NuGet/Home#5016
NuGet/Home#5706
Fixes:
Fixed include and exclude files performance
Regression? Last working version:
Description
Changed regex pattern for recursive wildcards to faster one.
Lazy quantifier in this case much faster. (.+\)* -> ([^\\]+\)*?
Added parallel processing in source files filtering
https://docs.microsoft.com/en-us/dotnet/api/system.linq.parallelenumerable.asparallel?view=net-5.0
Fixed linq lazy regex objects spawn.
Lazy filters enumeration in GetMatches method was called on every file entry. (Source file)
PR Checklist
[x ] PR has a meaningful title
[x ] PR has a linked issue.
[x ] Described changes
Tests
PathResolverTests already contains all needed tests.
Documentation