Closed Bug 355611 Opened 18 years ago Closed 11 years ago

Caching xmlarray length leads to bigger code

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: igor, Unassigned)

References

Details

In many places jsxml.c contains loop like:

for (i = 0, n = xml_array->length; i < n; i++) {
    complex_loop_body;
}

where n is not accessed outside the loop. But such optimization is harmful for code size as the compiler would be forced to generate code to save/restore the value of n before calling functions in complex_loop_body where the compiler can  not see their body.

Thus I suggest to replace the loops just by

for (i = 0; i < n = xml_array->length; i++) {
    complex_loop_body;
}

since due to the complexity of the body any speedup from reloading xml_array->length should not be observable.
I think we should get this fixed for js1.7 final.  Anyone disagree?

/be
Blocks: js1.7src
I am not working on the bug right now.
Assignee: igor → general
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.