broccolijs / broccoli

Browser compilation library – an asset pipeline for applications that run in the browser
https://broccoli.build
MIT License
3.33k stars 217 forks source link

Use a more appropriate data structure for nodeWrappers. #418

Closed stefanpenner closed 5 years ago

stefanpenner commented 5 years ago

Use a more appropriate data structure for nodeWrappers.

Since NodeWrappers lists:

This PR switches it from an array to a map.

As broccoli pipelines grow large, simply searching the array to detect duplicates on insertion can become very costly, and switching to a Map addresses this specific bottleneck.

stefanpenner commented 5 years ago

I think we should also add heimdall instrumentation for https://github.com/broccolijs/broccoli/blob/master/lib/builder.js#L170