Skip to content

Conversation

@DavyLandman
Copy link
Member

I've made a dedicated version of recursive file copy, as the packager would spend 95% of the time copying files, and our recursive copy implementation was less suited for this many files.

mkDirectory(to);
// directory
for (var child: sourceFS.directChildren(sourcePath)) {
var childPath = sourcePath + "/" + child;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a method here to, to hide the slash magic constant?

var childPath = sourcePath + "/" + child;
var childTarget = URIUtil.getChildLocation(to, child);
if (sourceFS.isFile(childPath) || recursive) {
localCopy(sourceFS, sourcePath + "/" + child, childTarget, recursive , overwrite);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, but the code already had this riddled in some places.

/**
* Copy a file or directory where the source and target are both in the same scheme
*/
default void localCopy(ISourceLocation from, ISourceLocation to, boolean recursive, boolean overwrite) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"local" is confusing to me. Of course for file and memory this is local but the API does not enforce locality. How about "internal" as it is internal too the scheme implementation? Or something with "scheme" in it. "schemeCopy"? Or "internalCopy", or simply just "copy" and it's documented that a resolver can only copy to its own scheme.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm for the last option. Just "copy". The context says a lot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it's only within the scheme, never across the scheme boundaries, so local to the resolver was my idea for the name.

Copy link
Member

@jurgenvinju jurgenvinju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great performance improvement. Curious about some micro benchmarks. I request one name change in the output interface. Otherwise it looks good. Nice that the memory resolver also chimes in 🦾 that makes this even more convincing.

@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 59.37500% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 46%. Comparing base (e97bfdc) to head (6ed3691).
⚠️ Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
...rc/org/rascalmpl/uri/libraries/MemoryResolver.java 50% 10 Missing and 3 partials ⚠️
src/org/rascalmpl/uri/URIResolverRegistry.java 42% 6 Missing and 2 partials ⚠️
src/org/rascalmpl/uri/file/FileURIResolver.java 86% 1 Missing and 2 partials ⚠️
src/org/rascalmpl/uri/ISourceLocationOutput.java 0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##              main   #2628    +/-   ##
========================================
- Coverage       46%     46%    -1%     
+ Complexity    6666    6658     -8     
========================================
  Files          794     795     +1     
  Lines        65746   65857   +111     
  Branches      9852    9872    +20     
========================================
- Hits         30646   30643     -3     
- Misses       32739   32842   +103     
- Partials      2361    2372    +11     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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