Tinderbox v10 Icon

Optimising code for performance

In small TBX files there is rarely a need to consider code optimisation, but as your files grow in note count and complexity and acquire more agents you may see the time-to update increase, i.e. how quickly code changes are effected. In such circumstances, or just as best practice, it is worth reviewing and applying a few optimisation techniques.

General practices

These do not directly affect code execution (other than by bad syntax) but help make everything else easier.

Prototypes

Using prototypes to set up and/or locate discrete sets of note(s) is a big productivity gain. Editing code (or code notes) once can then affect many notes. Consider using $RuleDisabled and $DisplayExpressionDisabled in the prototype so as to suppress execution of such code in the prototype. If applying prototypes as part of incremental formalisation, do not forget to reset the inheritance of any prototype-using note's attributes that may have previously had a local value set.

Check your syntax

Make sure your code does not include deprecated syntax. At some point in the future the code may not work at all and in the meantime you're making Tinderbox guess your real intent. Tinderbox does not warn about the existence deprecated code (it can't know what things are that the parser doesn't 'understand'), so updating code is an exercise left to the user.

Act on the right subject: originals vs. aliases

Be aware that if using actions in agents, you are acting on the original, so values of intrinsic attributes

Optimisation

These techniques can help with tuning performance once the size and complexity of your TBX grows:


See also—notes linking to here: