| Summary: | Bracket access is significantly slower than property access | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> | ||||
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Enhancement | CC: | barraclough, fpizlo, kling, mhahnenberg, mike | ||||
| Priority: | P2 | ||||||
| Version: | 528+ (Nightly build) | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
Note that it's 3.7x slower in the shipping Safari so it has gotten better. (In reply to comment #1) > Note that it's 3.7x slower in the shipping Safari so it has gotten better. 4.7x* |
Created attachment 233135 [details] Microbenchmark function getByVal(object, property) { return object[property]; } function getById(object) { return object.myProperty; } The first function appears to be ~3.5x slower than the second function even if getByVal is always called as getByVal(object, 'myProperty'). It's only 1.5x slower on Chrome 35 and 2.2x slower on Firefox 30.