title: Do I gain anything from packing numbers into an array for a Javascript (Typescript) struct?
body: <p>I'm declaring a Typescript class "Sample" but the same idea applies to Javascript.</p>
  
  <pre><code>export enum SampleData
  {
      PositionX = 0,
      PositionY,
      TangentX,
      TangentY,
  
      Max
  };
  
  export class Sample
  {
      data: number[] = new Array( SampleData.Max );
      x() { return this.data[SampleData.PositionX]; }
      y() { return this.data[SampleData.PositionY]; }
  }
  </code></pre>
  
  <p>Do I gain anything from packing numbers into an array for a Javascript (Typescript) struct? By "gain" I mean perf, memory, helping gc, etc.</p>
  
  <p>vs</p>
  
  <pre><code>export class Sample
  {
      x : number;
      y : number;
      tanX : number;
      tanY : number;
  }
  </code></pre>
  
  <p>Sample instances will ultimately end up in an array of Samples.</p>