Closed
Bug 95840
Opened 24 years ago
Closed 23 years ago
global property access should be made faster
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla0.9.5
People
(Reporter: jst, Assigned: jst)
Details
(Keywords: perf, Whiteboard: PDT+,[FIXED ON TRUNK], has a=)
Attachments
(4 files)
240 bytes,
text/html
|
Details | |
7.83 KB,
patch
|
Details | Diff | Splinter Review | |
9.42 KB,
patch
|
asa
:
approval+
|
Details | Diff | Splinter Review |
9.43 KB,
patch
|
jst
:
review+
jst
:
superreview+
jst
:
approval+
|
Details | Diff | Splinter Review |
Currently access to global properties is slowed down by the security check, even
by the optimization that's done to not do the security check in the case where
the object we're accessing properties on is the global object in the context.
This code can be optimized further, I'll attach a patch that makes global
property access ~4 times faster in debug builds, the test used is simply to time
how long it takes to execute while (++i < ahugenumber).
Testcase and patch coming up.
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
Assignee | ||
Comment 3•24 years ago
|
||
Mitchell, could you have a close look at the attached patch? Should we have
ckritzer beat on a build with these changes before checking in?
Status: NEW → ASSIGNED
OS: Windows 2000 → All
Priority: -- → P2
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.4
Comment 4•24 years ago
|
||
sr=vidur. There's a small issue with the possibility that a wrapper will be
reused (making the caching invalid), but generally a context and a global
wrapper have similar lifetime.
Assignee | ||
Comment 5•24 years ago
|
||
This patch gives us a ~45% speedup with the attached testcase in optimized builds.
Assignee | ||
Comment 7•24 years ago
|
||
In what way?
patch: **** malformed patch at line 110: JSVAL_TO_STRING(id) == sLocation_id;
Assignee | ||
Comment 9•24 years ago
|
||
Assignee | ||
Comment 10•24 years ago
|
||
R.K.Aa, could you try the latest patch, the old ones had rotted...
Comment 11•24 years ago
|
||
patches, builds, runs. All is well.
Comment 12•24 years ago
|
||
Building w/RH7.1 errata gcc 2.96-85. Testcase got around 3 times faster after
patching. Building with disable-debug, disable-tests, disable-logging,
enable-crypto, enable-optimize=-O2
Comment 13•24 years ago
|
||
r=mstoltz. Looks safe to me.
Comment 14•24 years ago
|
||
brendan aksed in email...
> If jband addresses vidur's sr= comment concern
>
> There's a small issue with the possibility that a wrapper will be
> reused (making the caching invalid), but generally a context and a global
> wrapper have similar lifetime.
> I would not object to this going in now. How is a wrapper reused for
> the global window? Does the invalidation just cause a performance hit,
> not any correctness problem?
>
> /be
I think jst got it right in the second patch (good that vidur pointed out the
issue!)
The normal mode for xpconnect wrapped natives is to build a new wrapper for each
scope - global object - to which the native is getting reflecting. For the DOM
support we added a PreCreate hook that the native helper can use to force the
parentage of the wrapper's JSObject. The hook is presented with a proposed
parent for the new wrapper JSObject and can reply with a differrent parent that
xpconnect will then use. This allows DOM JSObject parent chains to come out
right to satisfy the DOM fu. This same mechaism is used in the window case to
force xpconnect to always use only one wrapper for a window even when reflected
into other scopes. When xpconnect receives a different parent back from the
hook, xpconnect looks to that parent's global and if this does not match the
global it started with then xpconnect restarts the wrapping process using that
global as the scope. This will make it *find* the existing wrapper for that
'new' global object and not create a new wrapper as it had begun to do. This
yields the one and only one wrapper for the window. It only needs to do this
dance when reflecting the window into the 'view' of objects in other windows.
That window wrapper lives as long as any native holds a ref to it - which the
DOM does for the life of the window. The pointer could be reused after that - if
malloc coughs it up again. So the invalidation code is certainly the right thing
to do. I'm not seeing any correctness problem with the invalidation as written.
Comment 15•24 years ago
|
||
Comment on attachment 47636 [details] [diff] [review]
Updated patch, merged to the tip and contains Vidur's suggestions.
a=asa on behalf of drivers.
Attachment #47636 -
Flags: approval+
Updated•24 years ago
|
Whiteboard: [HAVE FIX] → [HAVE FIX], has a=
Assignee | ||
Comment 16•24 years ago
|
||
Asa added the above a= by mistake, this will land on the trunk once it opens and
then I'll check it in on the branch.
Assignee | ||
Comment 17•24 years ago
|
||
Fixed on the trunk.
Whiteboard: [HAVE FIX], has a= → [FIXED ON TRUNK], has a=
Pretty significant performance increase. Additionally the API changes in this
bug help Mitch to land some security fixes. Therefore nsbranch+.
Assignee | ||
Comment 19•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #49674 -
Flags: superreview+
Attachment #49674 -
Flags: review+
Attachment #49674 -
Flags: approval+
Comment 20•23 years ago
|
||
are the api changes exposed to just mitch, or might they be exposed to other
embedders that are trying to get stable on the 0.9.4 branch?
Comment 21•23 years ago
|
||
AFAICT, these api mods are to private core APIs.
if this is a big core perf improvement, 0.9.4 would be nice.
Comment 22•23 years ago
|
||
PDT+. Pls check it into today.
Whiteboard: [FIXED ON TRUNK], has a= → PDT+,[FIXED ON TRUNK], has a=
Assignee | ||
Comment 23•23 years ago
|
||
Fix checked in on the m094 branch.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•