Skip to content

Commit

Permalink
Merge pull request #478 from StoneCypher/DocumentArrowDirection
Browse files Browse the repository at this point in the history
Document arrow direction fixes StoneCypher/fsl#773, arrow_left_kind fixes StoneCypher/fsl#774, arrow_right_kind fixes StoneCypher/fsl#775, wrap_parse fixes StoneCypher/fsl#776, makeTransition fixes StoneCypher/fsl#777
  • Loading branch information
StoneCypher committed May 22, 2022
2 parents c9b40b1 + 63bb525 commit 0fd6005
Show file tree
Hide file tree
Showing 18 changed files with 472 additions and 119 deletions.
14 changes: 7 additions & 7 deletions benchmark/results/general.chart.html
Expand Up @@ -28,7 +28,7 @@
</head>
<body>
<div class="container">
<canvas id="chart1653095377530" width="16" height="9"></canvas>
<canvas id="chart1653226749814" width="16" height="9"></canvas>
</div>
<script>
const format = (num) => {
Expand All @@ -51,18 +51,18 @@
chunked.map((chunk) => chunk.join('')).join(' ') + fractionStr
)
}
const ctx1653095377530 = document
.getElementById('chart1653095377530')
const ctx1653226749814 = document
.getElementById('chart1653226749814')
.getContext('2d')
const chart1653095377530 = new Chart(ctx1653095377530, {
const chart1653226749814 = new Chart(ctx1653226749814, {
type: 'bar',
data: {
labels: ["Blind cycle a traffic light 500 times by transition","Blind cycle a traffic light 500 times by action","Blind cycle a basic-hooked traffic light 500 times by transition","Blind cycle a named-hooked traffic light 500 times by transition","Blind cycle an any-transition traffic light 500 times by transition","Blind cycle an exit hooked traffic light 500 times by transition","Blind cycle an enter hooked traffic light 500 times by transition","Blind cycle a standard-transition hooked light by transition","Blind cycle a main-transition hooked light by transition","Blind cycle a force-transition hooked light by transition","Blind cycle a traffic light 500 times by action","Blind cycle a basic-hooked traffic light 500 times by action","Blind cycle a named-hooked traffic light 500 times by action","Blind cycle an any-action traffic light 500 times by action","Blind cycle a global-action traffic light 500 times by action","Blind cycle an exit hooked traffic light 500 times by action","Blind cycle an enter hooked traffic light 500 times by action","Blind cycle a standard transition tl 500 times by action","Blind cycle a main transition tl 500 times by action","Blind cycle a forced transition tl 500 times by action","Kitchen Sink 500 times"],
datasets: [
{
data: [4764,11237,1323,5374,5372,5067,4481,4627,4723,24831,11868,1503,1293,10398,10799,8794,8891,51091,57521,58664,8354],
backgroundColor: ["hsl(9.744000000000007, 85%, 55%)","hsl(22.980000000000008, 85%, 55%)","hsl(2.712000000000006, 85%, 55%)","hsl(10.991999999999996, 85%, 55%)","hsl(10.991999999999996, 85%, 55%)","hsl(10.368, 85%, 55%)","hsl(9.168000000000001, 85%, 55%)","hsl(9.468000000000002, 85%, 55%)","hsl(9.659999999999997, 85%, 55%)","hsl(50.796, 85%, 55%)","hsl(24.276000000000003, 85%, 55%)","hsl(3.0720000000000027, 85%, 55%)","hsl(2.6400000000000037, 85%, 55%)","hsl(21.264, 85%, 55%)","hsl(22.091999999999995, 85%, 55%)","hsl(17.987999999999992, 85%, 55%)","hsl(18.191999999999993, 85%, 55%)","hsl(104.508, 85%, 55%)","hsl(117.66, 85%, 55%)","hsl(120, 85%, 55%)","hsl(17.087999999999994, 85%, 55%)"],
borderColor: ["hsl(9.744000000000007, 85%, 55%)","hsl(22.980000000000008, 85%, 55%)","hsl(2.712000000000006, 85%, 55%)","hsl(10.991999999999996, 85%, 55%)","hsl(10.991999999999996, 85%, 55%)","hsl(10.368, 85%, 55%)","hsl(9.168000000000001, 85%, 55%)","hsl(9.468000000000002, 85%, 55%)","hsl(9.659999999999997, 85%, 55%)","hsl(50.796, 85%, 55%)","hsl(24.276000000000003, 85%, 55%)","hsl(3.0720000000000027, 85%, 55%)","hsl(2.6400000000000037, 85%, 55%)","hsl(21.264, 85%, 55%)","hsl(22.091999999999995, 85%, 55%)","hsl(17.987999999999992, 85%, 55%)","hsl(18.191999999999993, 85%, 55%)","hsl(104.508, 85%, 55%)","hsl(117.66, 85%, 55%)","hsl(120, 85%, 55%)","hsl(17.087999999999994, 85%, 55%)"],
data: [4737,11565,1315,6401,5912,5838,5810,6112,5183,21664,13037,1558,1357,9430,10970,8558,8697,66884,67491,63318,8427],
backgroundColor: ["hsl(8.423999999999994, 85%, 55%)","hsl(20.567999999999998, 85%, 55%)","hsl(2.3400000000000034, 85%, 55%)","hsl(11.376000000000005, 85%, 55%)","hsl(10.512000000000006, 85%, 55%)","hsl(10.380000000000008, 85%, 55%)","hsl(10.331999999999999, 85%, 55%)","hsl(10.872000000000003, 85%, 55%)","hsl(9.216000000000008, 85%, 55%)","hsl(38.519999999999996, 85%, 55%)","hsl(23.18399999999999, 85%, 55%)","hsl(2.772000000000003, 85%, 55%)","hsl(2.412000000000006, 85%, 55%)","hsl(16.764, 85%, 55%)","hsl(19.5, 85%, 55%)","hsl(15.21600000000001, 85%, 55%)","hsl(15.468000000000002, 85%, 55%)","hsl(118.92, 85%, 55%)","hsl(120, 85%, 55%)","hsl(112.58399999999999, 85%, 55%)","hsl(14.987999999999994, 85%, 55%)"],
borderColor: ["hsl(8.423999999999994, 85%, 55%)","hsl(20.567999999999998, 85%, 55%)","hsl(2.3400000000000034, 85%, 55%)","hsl(11.376000000000005, 85%, 55%)","hsl(10.512000000000006, 85%, 55%)","hsl(10.380000000000008, 85%, 55%)","hsl(10.331999999999999, 85%, 55%)","hsl(10.872000000000003, 85%, 55%)","hsl(9.216000000000008, 85%, 55%)","hsl(38.519999999999996, 85%, 55%)","hsl(23.18399999999999, 85%, 55%)","hsl(2.772000000000003, 85%, 55%)","hsl(2.412000000000006, 85%, 55%)","hsl(16.764, 85%, 55%)","hsl(19.5, 85%, 55%)","hsl(15.21600000000001, 85%, 55%)","hsl(15.468000000000002, 85%, 55%)","hsl(118.92, 85%, 55%)","hsl(120, 85%, 55%)","hsl(112.58399999999999, 85%, 55%)","hsl(14.987999999999994, 85%, 55%)"],
borderWidth: 2,
},
],
Expand Down
136 changes: 68 additions & 68 deletions benchmark/results/general.json
@@ -1,141 +1,141 @@
{
"name": "General performance suite",
"date": "2022-05-21T01:09:37.530Z",
"date": "2022-05-22T13:39:09.814Z",
"version": "1.2.0",
"results": [
{
"name": "Blind cycle a traffic light 500 times by transition",
"ops": 4764,
"margin": 2.12,
"percentSlower": 91.88
"ops": 4737,
"margin": 9.49,
"percentSlower": 92.98
},
{
"name": "Blind cycle a traffic light 500 times by action",
"ops": 11237,
"margin": 2.24,
"percentSlower": 80.85
"ops": 11565,
"margin": 6.71,
"percentSlower": 82.86
},
{
"name": "Blind cycle a basic-hooked traffic light 500 times by transition",
"ops": 1323,
"margin": 1.89,
"percentSlower": 97.74
"ops": 1315,
"margin": 4.44,
"percentSlower": 98.05
},
{
"name": "Blind cycle a named-hooked traffic light 500 times by transition",
"ops": 5374,
"margin": 2.01,
"percentSlower": 90.84
"ops": 6401,
"margin": 1.25,
"percentSlower": 90.52
},
{
"name": "Blind cycle an any-transition traffic light 500 times by transition",
"ops": 5372,
"margin": 1.94,
"percentSlower": 90.84
"ops": 5912,
"margin": 2.31,
"percentSlower": 91.24
},
{
"name": "Blind cycle an exit hooked traffic light 500 times by transition",
"ops": 5067,
"margin": 2.54,
"percentSlower": 91.36
"ops": 5838,
"margin": 1.11,
"percentSlower": 91.35
},
{
"name": "Blind cycle an enter hooked traffic light 500 times by transition",
"ops": 4481,
"margin": 6.38,
"percentSlower": 92.36
"ops": 5810,
"margin": 1.33,
"percentSlower": 91.39
},
{
"name": "Blind cycle a standard-transition hooked light by transition",
"ops": 4627,
"margin": 7.61,
"percentSlower": 92.11
"ops": 6112,
"margin": 0.57,
"percentSlower": 90.94
},
{
"name": "Blind cycle a main-transition hooked light by transition",
"ops": 4723,
"margin": 6.28,
"percentSlower": 91.95
"ops": 5183,
"margin": 9.28,
"percentSlower": 92.32
},
{
"name": "Blind cycle a force-transition hooked light by transition",
"ops": 24831,
"margin": 1.03,
"percentSlower": 57.67
"ops": 21664,
"margin": 3.17,
"percentSlower": 67.9
},
{
"name": "Blind cycle a traffic light 500 times by action",
"ops": 11868,
"margin": 0.83,
"percentSlower": 79.77
"ops": 13037,
"margin": 3.54,
"percentSlower": 80.68
},
{
"name": "Blind cycle a basic-hooked traffic light 500 times by action",
"ops": 1503,
"margin": 3.54,
"percentSlower": 97.44
"ops": 1558,
"margin": 1.63,
"percentSlower": 97.69
},
{
"name": "Blind cycle a named-hooked traffic light 500 times by action",
"ops": 1293,
"margin": 5.34,
"percentSlower": 97.8
"ops": 1357,
"margin": 0.97,
"percentSlower": 97.99
},
{
"name": "Blind cycle an any-action traffic light 500 times by action",
"ops": 10398,
"margin": 0.91,
"percentSlower": 82.28
"ops": 9430,
"margin": 10.93,
"percentSlower": 86.03
},
{
"name": "Blind cycle a global-action traffic light 500 times by action",
"ops": 10799,
"margin": 0.9,
"percentSlower": 81.59
"ops": 10970,
"margin": 1.73,
"percentSlower": 83.75
},
{
"name": "Blind cycle an exit hooked traffic light 500 times by action",
"ops": 8794,
"margin": 4.32,
"percentSlower": 85.01
"ops": 8558,
"margin": 8.61,
"percentSlower": 87.32
},
{
"name": "Blind cycle an enter hooked traffic light 500 times by action",
"ops": 8891,
"margin": 4.05,
"percentSlower": 84.84
"ops": 8697,
"margin": 0.68,
"percentSlower": 87.11
},
{
"name": "Blind cycle a standard transition tl 500 times by action",
"ops": 51091,
"margin": 6.76,
"percentSlower": 12.91
"ops": 66884,
"margin": 0.76,
"percentSlower": 0.9
},
{
"name": "Blind cycle a main transition tl 500 times by action",
"ops": 57521,
"margin": 3.61,
"percentSlower": 1.95
"ops": 67491,
"margin": 0.63,
"percentSlower": 0
},
{
"name": "Blind cycle a forced transition tl 500 times by action",
"ops": 58664,
"margin": 3.19,
"percentSlower": 0
"ops": 63318,
"margin": 0.68,
"percentSlower": 6.18
},
{
"name": "Kitchen Sink 500 times",
"ops": 8354,
"margin": 3.15,
"percentSlower": 85.76
"ops": 8427,
"margin": 7.56,
"percentSlower": 87.51
}
],
"fastest": {
"name": "Blind cycle a forced transition tl 500 times by action",
"index": 19
"name": "Blind cycle a main transition tl 500 times by action",
"index": 18
},
"slowest": {
"name": "Blind cycle a named-hooked traffic light 500 times by action",
"index": 12
"name": "Blind cycle a basic-hooked traffic light 500 times by transition",
"index": 2
}
}
48 changes: 48 additions & 0 deletions dist/es6/jssm.d.ts
Expand Up @@ -4,9 +4,57 @@ JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmAr
import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
import { shapes, gviz_shapes, named_colors } from './jssm_constants';
import { version } from './version';
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_direction } from './jssm';
*
* arrow_direction('->'); // 'right'
* arrow_direction('<~=>'); // 'both'
* ```
*
*/
declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection;
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_left_kind } from './jssm';
*
* arrow_left_kind('<-'); // 'legal'
* arrow_left_kind('<='); // 'main'
* arrow_left_kind('<~'); // 'forced'
* arrow_left_kind('<->'); // 'legal'
* arrow_left_kind('->'); // 'none'
* ```
*
*/
declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind;
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_left_kind } from './jssm';
*
* arrow_left_kind('->'); // 'legal'
* arrow_left_kind('=>'); // 'main'
* arrow_left_kind('~>'); // 'forced'
* arrow_left_kind('<->'); // 'legal'
* arrow_left_kind('<-'); // 'none'
* ```
*
*/
declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
/*********
*
* Internal convenience method for alting out an object as the options call.
* Not generally meant for external use.
*
*/
declare function wrap_parse(input: string, options?: Object): any;
declare function compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>;
declare function make<mDT>(plan: string): JssmGenericConfig<mDT>;
Expand Down
54 changes: 54 additions & 0 deletions dist/es6/jssm.js
Expand Up @@ -6,6 +6,18 @@ import { parse } from './jssm-dot';
import { version } from './version'; // replaced from package.js in build
import { JssmError } from './jssm_error';
/* eslint-disable complexity */
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_direction } from './jssm';
*
* arrow_direction('->'); // 'right'
* arrow_direction('<~=>'); // 'both'
* ```
*
*/
function arrow_direction(arrow) {
switch (String(arrow)) {
case '->':
Expand Down Expand Up @@ -59,6 +71,21 @@ function arrow_direction(arrow) {
}
/* eslint-enable complexity */
/* eslint-disable complexity */
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_left_kind } from './jssm';
*
* arrow_left_kind('<-'); // 'legal'
* arrow_left_kind('<='); // 'main'
* arrow_left_kind('<~'); // 'forced'
* arrow_left_kind('<->'); // 'legal'
* arrow_left_kind('->'); // 'none'
* ```
*
*/
function arrow_left_kind(arrow) {
switch (String(arrow)) {
case '->':
Expand Down Expand Up @@ -101,6 +128,21 @@ function arrow_left_kind(arrow) {
}
/* eslint-enable complexity */
/* eslint-disable complexity */
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_left_kind } from './jssm';
*
* arrow_left_kind('->'); // 'legal'
* arrow_left_kind('=>'); // 'main'
* arrow_left_kind('~>'); // 'forced'
* arrow_left_kind('<->'); // 'legal'
* arrow_left_kind('<-'); // 'none'
* ```
*
*/
function arrow_right_kind(arrow) {
switch (String(arrow)) {
case '<-':
Expand Down Expand Up @@ -142,6 +184,12 @@ function arrow_right_kind(arrow) {
}
}
/* eslint-enable complexity */
/*********
*
* Internal method meant to perform factory assembly of an edge. Not meant for
* external use.
*
*/
function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
const kind = isRight ? arrow_right_kind(this_se.kind) : arrow_left_kind(this_se.kind), edge = {
from,
Expand Down Expand Up @@ -172,6 +220,12 @@ function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
}
return edge;
}
/*********
*
* Internal convenience method for alting out an object as the options call.
* Not generally meant for external use.
*
*/
function wrap_parse(input, options) {
return parse(input, options || {});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/es6/version.js
@@ -1,2 +1,2 @@
const version = "5.65.1";
const version = "5.65.2";
export { version };
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

0 comments on commit 0fd6005

Please sign in to comment.