marionettejs / marionette.inspector

:mag: Marionette Inspector - Explore your App
http://goo.gl/Wo3pju
MIT License
170 stars 42 forks source link

Optimize knownType and objectPath #354

Closed blikblum closed 6 years ago

blikblum commented 7 years ago

Part of #352 objectPath is the main bottleneck when serializing view or events. It's called very often. There are two factors that make it slow: the call to .rest and String.split. This PR avoids calling .rest by passing the path array alongside the index in nested calls. The split still there to, maybe, be handled later

knownType is also called a lot. This PR make its initialization explicit instead of by demand and reduce the number of calls to it.