Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. swifton
  3. Posts
  • Profile
  • More
    • Continue chat with swifton
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

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 • 30 Nov 2020, 00:40
RE: ArraySchema is very slow.

It looks like CollectionSchema has the same issue?

posted in Questions & Help • 28 Nov 2020, 10:18
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 • 28 Nov 2020, 09:28
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 • 28 Nov 2020, 08:37
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 • 27 Nov 2020, 07:10

© 2023 Endel Dreyer