Code Monkey home page Code Monkey logo

zfs-find-deduped's People

Contributors

mrighele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

zfs-find-deduped's Issues

Efficiency issues

for line in output.split(b'\n'):

for line in output.split('\n'):

These should probably be changed to use a streaming object, not split.

AFAIK, split will
a. block until it has its entire input (which is really huge on any real filesystem), and
b. then create the split array in memory (thereby doubling the already excessive RAM requirement).

Here, you just want to process it as a stream as fast as it comes in, since you´re not doing anything that requires the whole thing at once.

I don't know python well enough to suggest how to do it.

In Ruby, it'd be IO#gets (which is also in anything descending from IO, like File).

In plain Bash it'd be

while IFS='$\n' read -r line
do
  # do something with $line
done < process

print("Scanning filesystem", filesystem,"to gather file and block list...")
file_blocks = find_file_indirect_blocks(filesystem)
print("Scanning pool", pool,"to gather dedup block list...")
dedups = find_dedup_blocks(pool)

This should probably be reversed — there should be fewer dedup blocks than files, at least if you're only keeping ones where the block is used more than once — and then feed the resulting blocks-of-interest list to find_file_indirect_blocks to use as a stream filter, i.e. so that files not on the list are ignored (& not kept in memory).

Fixing these two things should vastly improve the efficiency of the script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.