Skip to content

Commit 347fe7f

Browse files
authored
adding notes on disabling friendly error system
clarifying what will be disabled and what will remain closes #3178
1 parent b243bb5 commit 347fe7f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

developer_docs/friendly_error_system.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,26 @@ p5.newObject = function(parameter) {
6969
````
7070
* Inline documentation: allowed parameter types are `Boolean`, `Number`, `String`, and name of the object (see the above bullet point). Use `Array` for any types of Array parameters. If needed, explain what kind of the specific types of array parameter are allowed (e.g. `Number[]`, `String[]`) in the description section.
7171
* Currently supported class types (have their `name` parameter): `p5.Color`, `p5.Element`, `p5.Graphics`, `p5.Renderer`, `p5.Renderer2D`, `p5.Image`, `p5.Table`, `p5.TableRow`, `p5.XML`, `p5.Vector`, `p5.Font`, `p5.Geometry`, `p5.Matrix`, `p5.RendererGL`.
72-
* By default, FES is enabled for p5.js, whereas completely disabled in p5.min.js to prevent FES functions slowing down the process. It is possible to disable FES by setting `p5.disableFriendlyErrors = true;` even while using p5.js.
72+
73+
## Disable the FES
74+
75+
By default, FES is enabled for p5.js, and disabled in p5.min.js to prevent FES functions slowing down the process. The error checking system can significantly slow down your code (up to ~10x in some cases). See the [friendly error performance test](https://github.com/processing/p5.js-website/blob/master/dist/assets/learn/performance/code/friendly-error-system/).
76+
77+
You can disable this with one line of code at the top of your sketch:
78+
79+
```javascript
80+
p5.disableFriendlyErrors = true; // disables FES
81+
82+
function setup() {
83+
// Do setup stuff
84+
}
85+
86+
function draw() {
87+
// Do drawing stuff
88+
}
89+
```
90+
91+
Note that this will disable the parts of the FES that cause performance slowdown (like argument checking). Friendly errors that have no performance cost (like giving an descriptive error if a file load fails, or warning you if you try to override p5.js functions in the global space), will remain in place.
7392

7493
## Known Limitations
7594
* The friendly error system slows the program down, so there is an option to turn it off via setting `p5.disableFriendlyErrors = true;`. In addition, the friendly error system is omitted by default in the minified (`p5.min.js`) version.

0 commit comments

Comments
 (0)