Closed Bug 200848 Opened 22 years ago Closed 22 years ago

Slow access of global variables

Categories

(Core :: Security, defect)

x86
Windows 95
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 169559

People

(Reporter: tpowellmoz, Assigned: security-bugs)

Details

(Keywords: perf)

Attachments

(1 file)

Accessing a JavaScript global variable is extremely slow in Mozilla 1.3. I don't understand why this is. The slowest is to use global variables outside a function, which I would imagine is quite common. Global variables are about 3 times slower than local variables in a function. Globals in functions in IE are also somewhat slower, but only about 1.5 times slower than its local variables.
I'm using this testcase to compare performance. Here's the results on the same computer (Pentium II 300MHz, 364M RAM): Mozilla 1.3: Local: 770ms Global: 2310ms Global not Function: 3960ms MS IE5.5: Local: 880ms Global: 1430ms Global not Function: 2190ms
Note that the testcase may load somewhat slowly initially because it tests globals outside a function when the page loads. Click the test button to test local and global variables in functions.
Summary: Slow access of global variables → Slow access of global variables
This is due to DOM security checks on global variables. That is, Mozilla does a security check on every global variable access; IE does not. Reassigning to Security:General to see if this cost can be mitigated in any way, and cc'ing jst -
Assignee: rogerl → mstoltz
Component: JavaScript Engine → Security: General
QA Contact: pschwartau → carosendahl
Actually, this bug is a duplicate of bug 169559. Tim, you will be cc'ed on that one so you can follow progress on this issue - *** This bug has been marked as a duplicate of 169559 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: