Git Product home page Git Product logo

walk's Introduction

walk and sor

This repository contains walk and sor, two utility programs that collectively replace find. walk recursively walks the directories specified on the command line (or the current directory, if none is specified), printing each file path. sor (“shell or”) reads file paths from standard input; for each path, it evaluates its arguments as Bash snippets, passing the path as an argument to each and printing the path if any snippet exits with status 0. For example, instead of saying

find . -type f -name \*foo\*

you can say

walk | grep foo | sor 'test -f'

If your filenames might contain newlines, you can say

walk -0 | grep -z foo | sor -0 'test -f'

Performance

By avoiding syscalls, walk achieves substantially better performance than find. A microbenchmark –

$ time find /usr >/dev/null

real    0m3.542s
user    0m0.880s
sys     0m2.646s
$ time walk /usr >/dev/null

real    0m2.311s
user    0m0.370s
sys     0m1.926s

– shows walk executing nearly 40% faster on a local file system with a hot cache. Performance on network file systems should be even better. On the other hand, find implements its predicates in-process, making them orders of magnitude faster than sor:

$ time find /usr -type f >/dev/null

real    0m3.464s
user    0m0.831s
sys     0m2.615s
$ time walk /usr | sor 'test -f' >/dev/null

real    7m40.127s
user    1m47.818s
sys     2m48.595s

History

walk and sor were originally written for Plan 9 from Bell Labs by Dan Cross. The original source is available.

Disclaimer

This is not an official Google product.

walk's People

Contributors

bbarenblat avatar cryslith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

walk's Issues

Tag release

Please tag a release for the repo, this makes inclusion in some package manager easier.

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.