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

Add optimized implementations of several MemoryFS methods #472

Merged
merged 6 commits into from
Mar 26, 2021
Merged

Conversation

althonos
Copy link
Member

Type of changes

  • New feature

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @PyFilesystem/maintainers may be pedantic in the code review.

Description

This PR adds dedicated implementations for some MemoryFS methods that were still using the base FS code. This includes:

  • move and movedir: the right directory entry is simply moved between folder, avoiding useless copy. Closes How to rename files in MemFS? #452 .
  • removetree: the entry is simply removed from its parents (in the case of removetree("/"), the entry is kept, but cleared)
  • scandir: the entry being scanned is now kept in memory in a dedicated method (the base implementation uses listdir + getinfo, which caused MemoryFS to lookup for the parent folder over and over).

@althonos althonos added this to the v2.4.13 milestone Mar 26, 2021
@althonos althonos changed the title Memfs opt Add optimized implementations of several MemoryFS methods Mar 26, 2021
@coveralls
Copy link

coveralls commented Mar 26, 2021

Coverage Status

Coverage increased (+0.03%) to 95.362% when pulling f26b7d1 on memfs-opt into 99d5314 on master.

@althonos althonos merged commit 13ec621 into master Mar 26, 2021
@althonos althonos deleted the memfs-opt branch March 26, 2021 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to rename files in MemFS?
2 participants