hmans Github contribution chart
hmans Github Stats
hmans Most Used Languages

Activity

05 Oct 2022

Hmans

Remove obsolete pnpm-lock

Pushed On 05 Oct 2022 at 02:18:16

Hmans

Fix it

Pushed On 05 Oct 2022 at 01:42:57
Create Branch
Hmans In hmans/composer-suite Create Brancheven-classier

Hmans

A suite of libraries for making game development with Three.js and React not only awesome, but so good, it would feel wrong to use anything else.

On 05 Oct 2022 at 01:22:37

Hmans

What in the fuck

Pushed On 05 Oct 2022 at 01:13:10

Hmans

useController

Pushed On 05 Oct 2022 at 12:34:28

Hmans

Cool

Pushed On 05 Oct 2022 at 12:34:28

Hmans

Cleanup

Pushed On 05 Oct 2022 at 12:20:32

Hmans

NormalizedGamepadDevice

Pushed On 05 Oct 2022 at 12:20:32

Hmans

Extract

Pushed On 05 Oct 2022 at 12:20:32

Hmans

Extract

Pushed On 05 Oct 2022 at 12:20:32

Hmans

Complete extraction

Pushed On 05 Oct 2022 at 12:20:32
Issue Comment

Hmans

UniformUnit from shader-composer-r3f reports an error under commonjs.

Stacks´╝Ü Uncaught SyntaxError: The requested module '/node_modules/react-reconciler/constants.js?v=8a72348b' does not provide an export named 'ConcurrentRoot'

How do I handle it gracefully?

Forked On 05 Oct 2022 at 11:48:39

Hmans

Can you share some more details about your project? Neither Shader Composer nor any other libraries in this suite interact with ConcurrentRoot directly, so at the moment that sounds more like an issue around React/R3F to me.

Commented On 05 Oct 2022 at 11:48:39
Issue Comment

Hmans

Destructuring performance

I was wondering about the performance of destructuring within systems so I decided to run some tests:

import { World } from "miniplex";
import { Entity } from "./miniplex";

const count = 1_000_000;
const iterations = 10;

const world = new World<Entity>();

const positions = world.archetype("position");

const profile = <T>(name: string, fn: () => T) => {
  const before = Date.now();
  const result = fn();
  const after = Date.now();
  console.log(`${name} took ${after - before}ms`);
  return result;
};

const createEntities = () => {
  const entities: Entity[] = [];

  for (let i = 0; i < count; i++)
    entities.push(world.createEntity({ position: { x: 0, y: i, z: 0 }, age: i }));

  return entities;
};

it(`works`, () => {
  profile(`create`, createEntities);

  profile(`destructured`, () => {
    for (let iter = 0; iter < iterations; iter++)
      for (const { position } of positions.entities) position.x += Math.random();
  });

  profile(`not-destructured`, () => {
    for (let iter = 0; iter < iterations; iter++)
      for (const entity of positions.entities) entity.position.x += Math.random();
  });

  profile(`simple for`, () => {
    for (let iter = 0; iter < iterations; iter++)
      for (let i = 0; i < positions.entities.length; i++)
        positions.entities[i]!.position.x += Math.random();
  });
}); 

Results are:

 console.log
    create took 1794ms

  console.log
    destructured took 2363ms

  console.log
    not-destructured took 1502ms

  console.log
    simple for took 1473ms 

So it looks like destructuring has quite a large impact.. having said that tho there could be some CPU vectorization / JIT'ing going on here that might cause oddness.

Forked On 05 Oct 2022 at 08:38:37

Hmans

The difference evens out with a lower number of entities and a higher number of iterations:

 console.log
    simple for took 752ms

  console.log
    not-destructured took 724ms

  console.log
    destructured took 719ms 

Commented On 05 Oct 2022 at 08:38:37
Issue Comment

Hmans

Destructuring performance

I was wondering about the performance of destructuring within systems so I decided to run some tests:

import { World } from "miniplex";
import { Entity } from "./miniplex";

const count = 1_000_000;
const iterations = 10;

const world = new World<Entity>();

const positions = world.archetype("position");

const profile = <T>(name: string, fn: () => T) => {
  const before = Date.now();
  const result = fn();
  const after = Date.now();
  console.log(`${name} took ${after - before}ms`);
  return result;
};

const createEntities = () => {
  const entities: Entity[] = [];

  for (let i = 0; i < count; i++)
    entities.push(world.createEntity({ position: { x: 0, y: i, z: 0 }, age: i }));

  return entities;
};

it(`works`, () => {
  profile(`create`, createEntities);

  profile(`destructured`, () => {
    for (let iter = 0; iter < iterations; iter++)
      for (const { position } of positions.entities) position.x += Math.random();
  });

  profile(`not-destructured`, () => {
    for (let iter = 0; iter < iterations; iter++)
      for (const entity of positions.entities) entity.position.x += Math.random();
  });

  profile(`simple for`, () => {
    for (let iter = 0; iter < iterations; iter++)
      for (let i = 0; i < positions.entities.length; i++)
        positions.entities[i]!.position.x += Math.random();
  });
}); 

Results are:

 console.log
    create took 1794ms

  console.log
    destructured took 2363ms

  console.log
    not-destructured took 1502ms

  console.log
    simple for took 1473ms 

So it looks like destructuring has quite a large impact.. having said that tho there could be some CPU vectorization / JIT'ing going on here that might cause oddness.

Forked On 05 Oct 2022 at 08:29:14

Hmans

Turning around the order of execution yielded the following results, making destructured access appear significantly faster:

 console.log
    create took 603ms

  console.log
    not-destructured took 1196ms

  console.log
    destructured took 756ms

  console.log
    simple for took 751ms 

As far as I know, the JavaScript runtime is pretty efficient at inlining destructuring statements. I assume what you're seeing here is the effect of caching.

Commented On 05 Oct 2022 at 08:29:14

Hmans

Eh

Pushed On 04 Oct 2022 at 07:58:22

Hmans

Make scheme a class

Pushed On 04 Oct 2022 at 07:36:19

Hmans

Less magic

Pushed On 04 Oct 2022 at 06:57:51

Hmans

Cleanup

Pushed On 04 Oct 2022 at 06:49:11

Hmans

AbstractDevice

Pushed On 04 Oct 2022 at 06:29:41

Hmans

Switch control scehem

Pushed On 04 Oct 2022 at 06:29:41

Hmans

schemes!

Pushed On 04 Oct 2022 at 05:31:56

Hmans

schemes?!

Pushed On 04 Oct 2022 at 05:31:56

Hmans

clampLength

Pushed On 04 Oct 2022 at 05:20:57

Hmans

clampLength with limit

Pushed On 04 Oct 2022 at 05:20:57

Hmans

Deadzone

Pushed On 04 Oct 2022 at 05:20:57

Hmans

Use control events

Pushed On 04 Oct 2022 at 05:16:19

Hmans

Handle schemes a little better

Pushed On 04 Oct 2022 at 05:09:16

Hmans

onPress

Pushed On 04 Oct 2022 at 05:09:16

Hmans

Schemes

Pushed On 04 Oct 2022 at 05:02:29

Hmans

Classy Input Composer

Created On 04 Oct 2022 at 04:56:06
Create Branch
Hmans In hmans/composer-suite Create Branchclassy-input-composer

Hmans

A suite of libraries for making game development with Three.js and React not only awesome, but so good, it would feel wrong to use anything else.

On 04 Oct 2022 at 04:55:44

Hmans

Cleanup

Pushed On 04 Oct 2022 at 12:15:12
Create Branch
Hmans In hmans/composer-suite Create Branchspacerage-production

Hmans

A suite of libraries for making game development with Three.js and React not only awesome, but so good, it would feel wrong to use anything else.

On 04 Oct 2022 at 11:17:33

Hmans

Update Miniplex in other libraries

Pushed On 04 Oct 2022 at 11:17:17

Hmans

Update miniplex

Pushed On 04 Oct 2022 at 08:55:32

Hmans

miniplex 1.0!

Pushed On 04 Oct 2022 at 08:55:32

Hmans

Version Packages (#157)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Pushed On 04 Oct 2022 at 08:42:17
Pull Request

Hmans

Version Packages

Created On 04 Oct 2022 at 08:42:17
Issue Comment

Hmans

Remove `Archetype.first`

It's confusing, and the user can just do this instead:

const [first] = archetype 

Forked On 04 Oct 2022 at 08:41:31

Hmans

Done in #168

Commented On 04 Oct 2022 at 08:41:31