Repository navigation
v0.2.5
This version is a patch. It makes relaxForces faster for 200 boxes or more, and it adds the option theta to relaxForces and to the strategy force. With the default of the option, each layout stays the same.
relaxForceskeeps the positions in typed lists of numbers, and the separation passes find the near boxes with a grid. The positions are the positions of 0.2.4, bit for bit. A test compares the function with the steps of 0.2.4 on random inputs.- The new option
thetais a number from 0 toMAX_THETA, which is 1. The default is 0. Then the repulsion reads each pair of boxes, as in 0.2.4, and its time grows with the square of the number of boxes. - With a
thetaof more than 0, a far group of boxes repels a box as one box. This is the method of Barnes and Hut. The time of the repulsion then grows approximately as the number of boxes times its logarithm. A usual value is 0.9. - With a
thetaof more than 0, the positions are near the positions of athetaof 0, but they are not the same. No two boxes are nearer than the margin, as before. - The layout schema of the strategy
forcehas the fieldtheta, and the builderforceaccepts it.ireko/strategies/forceexports the constantMAX_THETA. thetais a field of the typesRelaxOptionsandForceOptions.relaxForces, a layout document and the builder use the default, so they need no change. Code that makes a full value of one of these types by hand must addtheta: 0.- The gzip size of
ireko/strategies/forcegoes from 2.75 kB to 4.50 kB, and its size limit goes from 3.2 kB to 4.7 kB. The size of each other entry does not change. - The new workflow
bench-relax.ymlmeasuresrelaxForcesagainst 0.2.4 on pictures of 50 to 1600 boxes, each arm in a fresh process. It fails when the default gives a different position. - The first job of the workflow measured 7 rounds on an AMD EPYC 7763 with Node.js 24.22. Each number below is the median time divided by the median time of 0.2.4.
- With the default, the number is 0.94 at 200 boxes, 0.86 at 400 boxes, 0.76 at 800 boxes and 0.73 at 1600 boxes.
- With a
thetaof 0.9, the number is 0.69 at 200 boxes, 0.49 at 400 boxes, 0.28 at 800 boxes and 0.18 at 1600 boxes. - At 100 boxes or fewer, the first use in a new process is slower than 0.2.4. It adds approximately 10 ms at 50 boxes (34 ms before) and 5 ms at 100 boxes (65 ms before).
- The build bundles
@mark1russell7/text0.0.15 (before, 0.0.5). The bundled code is the same. Thus only the files ofireko/strategies/forceare different from 0.2.4.
Runtime dependencies: no change against 0.2.4 (none). @mark1russell7/text ^0.0.15 is a dev dependency, and the build bundles it.