Closed Bug 904962 Opened 11 years ago Closed 11 years ago

Avoid some "critical" #includes in and around SpiderMonkey

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [js:t])

Attachments

(5 files, 1 obsolete file)

Attachment 789006 [details] from bug 901132 has a list of #include statements listed by "criticality".  For each #include statement, if it were removed, the number indicates (approximately) how many fewer times we would read the corresponding header during a browser build.

I have some patches that remove some of the critical #includes, which are:

- 2891 js/public/CharacterEncoding.h from js/src/jsapi.h 
- 2136 mfbt/ThreadLocal.h from js/src/jsapi.h 
- 173 js/src/yarr/YarrSyntaxChecker.h from js/src/vm/RegExpObject.h 
- 148 --GENERATED--/js/src/jsautooplen.h from js/src/vm/Stack.h
-  73 js/src/vm/String-inl.h from js/src/gc/Barrier-inl.h

Plus a couple of other patches that remove unnecessary #includes that I had lying around.

With these, I see a 1.5% speed-up when building SpiderMonkey.  But there will also be effects outside SpiderMonkey by removing the first two cases in the list above.

I have a similar analysis script that works just within SpiderMonkey.  Here are some notable changes in how often some headers are included during a JS shell build, once these patches are applied:

vm/MatchPairs.h:          176 --> 7
vm/String-inl.h:          112 --> 10
yarr/YarrParser.h:        178 --> 3
yarr/YarrSyntaxChecker.h: 177 --> 2
Comment on attachment 789951 [details] [diff] [review]
(part 4) - Don't #include jsautooplen.h in vm/Stack.h.

Review of attachment 789951 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/vm/Stack.cpp
@@ +450,5 @@
>  }
>  
>  /*****************************************************************************/
>  
> +// Unlike the other methods of this calss, this method is defined here so that

class
Attachment #789948 - Flags: review?(luke) → review+
Attachment #789949 - Flags: review?(luke) → review+
Attachment #789950 - Flags: review?(luke) → review+
Attachment #789951 - Flags: review?(luke) → review+
Attachment #789952 - Flags: review?(luke) → review+
Attachment #789953 - Flags: review?(luke) → review+
Comment on attachment 789952 [details] [diff] [review]
(part 5) - Don't #include vm/String-inl.h in gc/Barrier-inl.h.

> (part 5) - Don't #include vm/String-inl.h in gc/Barrier-inl.h.

Try server tells me that this patch breaks the world, so I won't include it when I land the others.
Attachment #789952 - Attachment is obsolete: true
Attachment #789953 - Attachment description: (part 6) - Don't #include jsprf.h in three places it isn't needed. → (part 5) - Don't #include jsprf.h in three places it isn't needed.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: