GithubHelp home page GithubHelp logo

Comments (3)

Adamkob12 avatar Adamkob12 commented on May 27, 2024

As I see it, there are two options: (please correct me if I'm wrong, I'm writing this without much experience in the storage system)

Option 1

  1. Split BlobVec into RawBlobVec and BlobVec (like Vec's implementation)
  2. Use RawBlobVec and RawVec in Column
  3. Use a single length value for all columns in Table
    This will reduce 3*columns - 1 usizes from each Table (8[4]*(3*columns-1) bytes), not too shabby.

Option 2

Similar to option 1, but instead of RawVecs, Column will just store (small abstractions over) raw pointers.
Capacity and length will be stored at the Table level.
This will reduce 6*columns - 2 usizes from each Table (8[4]*(6*columns-2) bytes), twice as much as option 1.

from bevy.

james7132 avatar james7132 commented on May 27, 2024

Option 2 would be strongly preferred, though some other paths might need to be retained to keep support ComponentSparseSet, intact.

Bikeshedding here, but a RawBlobVec is just a Blob.

One thing to note is that the capacity of BlobVec is set to usize::MAX for ZSTs, which may not play well with this setup.

bevy_ptr has the concept of a ThinSlicePtr<'a, T> which is a NonNull that becomes a slice in debug builds. We may want to use a ThinVec<T> of the same nature to handle the component ticks in Column.

from bevy.

Adamkob12 avatar Adamkob12 commented on May 27, 2024

Now that I think about it, option 2 would save a lot branching - it's a must.
This does make me wonder if the ZSTs should be stored separately, maybe one SparseSet for ZSTs, and one for normal ones (eg):

struct Table {
    columns: ImmutableSparseSet<ComponentId, Column<false>>,
    zst_columns: ImmutableSparseSet<ComponentId, Column<true>>,
    cap: usize,
    len: usize
    entities: Vec<Entity>,
}
// ..
struct Column<const IS_ZST: bool> { .. }

from bevy.

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.