Closed Bug 898692 Opened 11 years ago Closed 11 years ago

Wasted work in ArrayBufferObject::obj_trace()

Categories

(Core :: JavaScript Engine, defect)

x86_64
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: pchang9, Assigned: pchang9)

Details

(Keywords: perf, Whiteboard: patch)

Attachments

(1 file, 3 obsolete files)

Attached patch Suggested patch (obsolete) — Splinter Review
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 (Beta/Release)
Build ID: 20130116073211

Steps to reproduce:

The problem appears in changeset 138350:18467a85acf6. I have attached a simple one-line patch that fixes it.

In method main() in js/src/vm/TypedArrayObject.cpp, the loop on line 701 should break immediately after "found" is set to "true". All the iterations after "found" is set to "true" do not perform any useful work, at best they just set "found" again to "true".



Expected results:

Break loop after "found" is set to "true".
Keywords: perf
OS: Windows 7 → All
Version: 18 Branch → Trunk
Attachment #782049 - Attachment is patch: true
> In method main() in js/src/vm/TypedArrayObject.cpp, the loop

It's about the DEBUG section in https://hg.mozilla.org/mozilla-central/file/18467a85acf6/js/src/vm/TypedArrayObject.cpp#l680
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Whiteboard: patch
Assignee: general → pchang9
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
This makes sense, yes. We don't care that much about DEBUG perf, but it's not entirely irrelevant, either.

@pchang9, would you mind looking at [1] to prepare a patch for checkin? If it's too much work, then don't worry - we can fix things up for you. In that case, we'd at least know which name and email address the patch should contain as author information.


[1]: https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F
Thanks for your information. Patch is prepared (898692.patch).
Attached patch 898692.patch (obsolete) — Splinter Review
Attachment #783510 - Flags: review?(sphink)
Comment on attachment 783510 [details] [diff] [review]
898692.patch

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

::: js/src/vm/TypedArrayObject.cpp
@@ +697,3 @@
>                          found = true;
> +                        break;
> +                    }

Actually, I'd prefer if you made this *slower*. :-)

Specifically, rather than breaking, can you JS_ASSERT(!found) just before setting found = true? That will check that each buffer shows up exactly once in the list (rather than at least once, as my slow version and your faster version did.)

Thanks!
Attachment #783510 - Flags: review?(sphink)
Attachment #782049 - Attachment is obsolete: true
Attached patch 898692-1.patch (obsolete) — Splinter Review
Attachment #783510 - Attachment is obsolete: true
Attachment #785391 - Flags: review?(sphink)
Comment on attachment 785391 [details] [diff] [review]
898692-1.patch

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

Perfect, thanks!
Attachment #785391 - Flags: review?(sphink) → review+
Keywords: checkin-needed
Attachment #785391 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/9852ea4110eb
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Great, thank you for this. Now you're ready to dive in deeper, right? :-)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: