Coder Social home page Coder Social logo

optimize `Tree.from_list()` about dvc-data HOT 3 CLOSED

iterative avatar iterative commented on June 6, 2024
optimize `Tree.from_list()`

from dvc-data.

Comments (3)

skshetry avatar skshetry commented on June 6, 2024 1

@dberenbaum, Tree.load() is used to .dir file from cache.
Tree.from_list is a bit generic in that it can also load from files section in .dvc files.

Tree loading creates 2 objects: Meta, HashInfo, and this above profiling is for CelebA where we build 500k of those instances. You can see above that it takes 1.5s just to load that in memory.

Of course, we are not doing anything bad here. It's just Python being slow, we have already optimized this in terms of memory and performance. I opened this issue for exploring other ways to improve this.

This affects a lot of commands. Eg: data status has to load all .dir files in memory times 2 (from Git HEAD and from the hash in .dvc file). So a lot of time is lost just loading this in memory.

from dvc-data.

skshetry avatar skshetry commented on June 6, 2024 1

I played with Cython (which required 0 code changes), and got 20-30% improvement. But it will require a lot of infrastructure changes. It has to be 5x-10x improvement to be worth it here.

from dvc-data.

dberenbaum avatar dberenbaum commented on June 6, 2024

@skshetry Do you have a more "high-level" use case where you can show how much of an impact it has?

from dvc-data.

Related Issues (20)

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.