Open
Bug 1356594
Opened 8 years ago
Updated 2 years ago
Rewrite AppConstants.jsm in C++
Categories
(Toolkit :: General, defect, P3)
Toolkit
General
Tracking
()
NEW
Performance Impact | low |
People
(Reporter: mccr8, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: perf:resource-use, Whiteboard: [overhead:50k])
AppConstants.jsm defines a bunch of build-specific constants. In addition to the 30kb to 50kb or whatever jsm overhead, there's about a thousand characters of properties and 100 characters of data. All of this is static, so it should be possible to share it between all processes if it was written in C++. (I don't know if XPIDL or WebIDL makes more sense.) The code is really trivial so there shouldn't be much danger of introducing hazards with it.
I started looking at it, but I'm not sure how to deal with the @MOZ_APP_VERSION@-type of macro expansion. At least some of these @MACROS@ appear to be used as regular C macros in some files, but I don't know what defines them.
Comment 1•8 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #0)
> AppConstants.jsm defines a bunch of build-specific constants. In addition to
> the 30kb to 50kb or whatever jsm overhead, there's about a thousand
> characters of properties and 100 characters of data. All of this is static,
> so it should be possible to share it between all processes if it was written
> in C++. (I don't know if XPIDL or WebIDL makes more sense.) The code is
> really trivial so there shouldn't be much danger of introducing hazards with
> it.
This is a great idea!
> I started looking at it, but I'm not sure how to deal with the
> @MOZ_APP_VERSION@-type of macro expansion. At least some of these @MACROS@
> appear to be used as regular C macros in some files, but I don't know what
> defines them.
They're defined via DEFINES in moz.build and the build system, e.g.:
http://dxr.mozilla.org/mozilla-central/source/toolkit/modules/moz.build#264
Comment 2•8 years ago
|
||
Florian was also interested in inefficient things we expose to JS; this is definitely one of those things. His rewrite-all-the-JS experience might come in handy here as well.
Reporter | ||
Comment 3•8 years ago
|
||
Another example of moz.build stuff needed to define these constants that Nathan pointed out to me in IRC is:
for var in ('ANDROID_PACKAGE_NAME',
'MOZ_APP_NAME',
'MOZ_APP_VERSION',
'MOZ_APP_VERSION_DISPLAY',
'MOZ_MACBUNDLE_NAME',
'MOZ_WIDGET_TOOLKIT',
'DLL_PREFIX',
'DLL_SUFFIX',
'DEBUG_JS_MODULES'):
DEFINES[var] = CONFIG[var]
Comment 4•8 years ago
|
||
What's the exact criteria that we use here? When I was working on bug 1250473 I was wondering whether it should be written in C++ also because it seemed like we could simplify a ton of things if we didn't have so many layers of abstractions between Gecko and this bit of toolkit code...
Comment 5•7 years ago
|
||
AppConstants.jsm is also one of the latest JS files making use of the preprocessor, it would be nice to get rid of that.
Updated•7 years ago
|
Blocks: photon-startup
Comment 6•7 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #0)
> All of this is static, so it should be possible to share it between all
> processes if it was written in C++.
I'd be surprised if we managed to share very much between processes. Most of
the ways we usually reflect things like this to JS still require creating all
of the same properties on the JS reflector or its prototypes. And if we
generally wind up creating separate reflectors for each compartment, so if
we're not careful, we could actually wind up using more memory...
We could probably avoid some of that by natively resolving properties each
time, rather than defining them on reflectors, but that could potentially hurt
performance a lot. And for string properties, we'd have to be careful not to
create new JS strings for every lookup.
Updated•7 years ago
|
Whiteboard: [fxperf]
Updated•7 years ago
|
Priority: -- → P3
Updated•7 years ago
|
Flags: needinfo?(gijskruitbosch+bugs)
Whiteboard: [fxperf] → [fxperf:p3]
Updated•6 years ago
|
Whiteboard: [fxperf:p3] → [fxperf:p3][overhead:50k]
Comment 7•3 years ago
|
||
Gijs, is this still a good idea and something you'd like to follow up on?
Comment 8•3 years ago
|
||
(In reply to Jared Hirsch [:jhirsch] [:_6a68] (Needinfo please) from comment #7)
Gijs, is this still a good idea and something you'd like to follow up on?
I think it's still a good idea but it's complex enough (and I'm busy enough) that I'm unlikely to do it myself. The comments have a good overview of some of the complexity here. In addition to what's mentioned here, all the various modules and JS files importing the module isn't free, so fixing that, too, would be a boon. If the strings are a problem for memory use, perhaps we could replace the AppConstants platform strings with separate properties (AppConstants.XP_WIN
and such) that would be bool.
Performance Impact: --- → P3
Flags: needinfo?(gijskruitbosch+bugs)
Keywords: perf:resource-use
Whiteboard: [fxperf:p3][overhead:50k] → [overhead:50k]
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•