Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Performance overhead of PIXI.Container

$
0
0

Hello!

I was wondering if `PIXI.Containers` have any associated performance overhead.

Take the following examples:

Example #1: Extending Container:

class SpriteTile extends PIXI.Container {
  constructor(resource) {
    super();

    // Create a sprite and add it to children
    const sprite = new PIXI.Sprite.fromImage(resource);
    this.addChild(sprite);
  }

}

Example #2: Extending Sprite directly: 

class SpriteTile extends PIXI.Sprite {
  constructor(resource) {
    super(resource);
  }

}

Both examples achieve the same thing.

Example #1, while seemingly more obscure, keeps a certain level of extensibility by having the freedom of a Container.

Example #2 is much more direct but is now also limited to the functionality of a simple Sprite.

My question being; is there any (notable?) performance benefit over choosing example #2 over #1 in the use cases as shown above?

Thanks in advance!

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>