Skip to content

Speedup

A major part of improving the ecosystem for everyone is speed. The speed of core packages, tools and more can always be improved and will benefit the community as a whole.

A few groups and individuals are working in this space. Just some of these are listed below:

Linting

Some performance improvements can be detected via a linter.

ESLint

For those of us using ESLint, a few plugins are available which strongly align with the principals of the e18e effort:

PluginDescription
eslint-plugin-dependDetects redundant packages and suggests more performant replacements
eslint-plugin-barrel-filesDetects barrel/index files

Biome

Biome supports some rules out of the box which align with e18e:

Coding tips

The code you write plays an important role in the performance of your app. Some patterns are highlighted below for common pitfalls and ways to improve it. Remember to always profile your code when making performance changes!

Avoid generators for hot code paths

At the moment, most JavaScript engines do not optimize generator function calls which leads to a large performance hit if used extensively.

Prefer using non-async iterators or plain arrays.

Avoid chaining array methods

Chaining array methods like map, filter, reduce, etc leads to many intermediate arrays being created and disposed, causing more work for the garbage collector. Each chain also leads to an extra iteration, which can be more times than needed.

Prefer using for loops, for...in loops, andfor...of loops, or a single chain method only to prevent the caveats above.

Released under the MIT License. (c7fdb44c)