mozilla / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
176 stars 278 forks source link

Eliminate Inspector.json #288

Closed humphd closed 9 years ago

humphd commented 9 years ago

The 3rd largest file loaded by Bramble is https://github.com/adobe/brackets/blob/decd8e4602d1bd17b048e35ac6a2097f2836d539/src/LiveDevelopment/Inspector/Inspector.json at 231K of mostly strings that can't be minified well. I need to look at this more closely, but a quick glance leads me to believe that we don't need it in the browser at all with MultiBrowserLiveDev.

@busykai, can you confirm? If so, I'm just going to write a patch for our fork that doesn't load this at all. It would be nice to not incur the download cost for this file, and related.

busykai commented 9 years ago

@humphd, yes, it's CDT's interface from which Inspector interface is generated. It's not needed and not used in the multi-browser version.

I believe a much more efficient solution, loading-wise, would be to avoid loading entire LiveDevelopment/LiveDevelopmentimplementation. You'd need to remove initialization main.js:307-308, remove require of these (leave the vars though) and make sure to never call _setImplementation with false. That should not deviate you too much from the upstream (and should not be hard to implement).

MultiBrowserLiveDev has dependencies on some modules in the other implementations, but they it loads them if needed. I guess what I'm saying is do not remove all the files. :)

We should have done a better job at separating the implementations, but we could not change module locations since some extensions (most notably Adobe's Extract) relied on LiveDevelopment/LiveDevelopment being there. Something on [the bottom of] the TODO list... Lots of the code could be consolidated there...

humphd commented 9 years ago

@busykai, thanks for the ideas. I started in on this (see WIP patch), but it looks like it's going to mean a bunch of changes to other parts of the code that require LiveDevelopment/LiveDevelopment and Inspector. For example, lots of stuff seems to need access to one or both of these, even if they aren't really used in the browser:

I'm not crazy about the idea of hacking this much of the code up for our fork, and diverging so much. Any other ideas?

humphd commented 9 years ago

Actually, it's src/brackets.js that's causing these to get included by require in the _initTest stuff.

humphd commented 9 years ago

I think I got something that's not too horrible. @busykai, can you take a look at https://github.com/humphd/brackets/pull/291 and see if you see any obvious problems? This seems to stop a lot of what I don't need from loading, without too much surgery.