Navigation

    Colyseus
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. swifton
    S

    swifton

    @swifton

    Chat Follow Unfollow
    0
    Reputation
    6
    Posts
    925
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with swifton
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    swifton Follow

    Posts made by swifton

    RE: ArraySchema is very slow.

    I was using it to store tiled maps. I ended up replacing it with a MapSchema -- it works pretty well for my needs so far.

    For the general problem, maybe you could make this easier by getting rid of some more advanced functionality? Taking linear (or even superlinear?) time to look at one element of an array is a very odd thing to see. I think it's more important to fix this basic functionality than to have all these operations. It's your decision to make though.

    posted in Questions & Help •
    RE: ArraySchema is very slow.

    It looks like CollectionSchema has the same issue?

    posted in Questions & Help •
    RE: ArraySchema is very slow.

    It looks like it is a known issue. What was the intended way to fix this?

    colyseus/schema repository, ArraySchema.ts, line 147

    at(index: number) {
        //
        // FIXME: this should be O(1)
        //
        const key = Array.from(this.$items.keys())[index];
        return this.$items.get(key);
    }
    posted in Questions & Help •
    RE: ArraySchema is very slow.

    In fact, the larger the array, the slower is a single address. This is also true on the client side.

    posted in Questions & Help •
    ArraySchema is very slow.

    I did some measurements and found that in my game it takes tens of thousands of cycles to address a single member of an array of numbers. Is this usual behavior? And is there some workaround to prevent this?

    posted in Questions & Help •