Closed Bug 91168 Opened 23 years ago Closed 23 years ago

Search sidebar compiles result list even when panel is not visible

Categories

(SeaMonkey :: Search, defect, P3)

x86
All

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.7

People

(Reporter: jruderman, Assigned: samir_bugzilla)

References

Details

(Keywords: hang, perf)

Attachments

(2 files)

From bug 77460, buglists hang mozilla for long periods of time using all available CPU: dbaron is fixing 77460 by making the search sidebar code more efficient. But when the search sidebar isn't shown, that code shouldn't be called at all, because no matter how efficient it is, it's going to slow down the query results page. (This includes when the sidebar is collapsed, when the sidebar is turned off, and when a different panel is visible.)
Keywords: perf
nav triage team: Marking p3 and mozilla0.9.5
Priority: -- → P3
Target Milestone: --- → mozilla0.9.5
Keywords: nsbeta1+
See also bug 53239, alexa "What's Related" panel contacts server even if panel is not visible.
The checking code should go in here http://lxr.mozilla.org/mozilla/source/xpfe/components/search/src/nsInternetSearc hService.cpp#2515 We don't have a service to detect if the sidebar panel is open though
Note: comments from bug 54542 indicate that with searches for large numbers of items (like all NEW bugs in bugzilla) can cause a 15 _minute_ freeze.
Changing OS to all. I am voting for this because of the bugzilla buglist issue. Should be topperf IMO.
OS: Windows NT → All
Did the fix for bug 53239 fix this?
No.
As long as bug 77460 is open, this bug effectively causes Mozilla to freeze whenever I look at the UNCO list.
Keywords: hang
Taking.
Assignee: matt → sgehani
Target Milestone: mozilla0.9.5 → mozilla0.9.6
Moving to mozilla0.9.7.
Target Milestone: mozilla0.9.6 → mozilla0.9.7
jruderman, pchen, or morse, please r. alecf, please sr.
Status: NEW → ASSIGNED
Keywords: patch, review
Comment on attachment 57789 [details] [diff] [review] Don't compute results is search panel isn't open and "auto open search panel" isn't set. sr=alecf
Attachment #57789 - Flags: superreview+
*** Bug 108172 has been marked as a duplicate of this bug. ***
+function isSearchPanelOpen() +{ + var isOpen = false; + + if (!sidebar_is_hidden() && !sidebar_is_collapsed()) + { + if (SidebarGetLastSelectedPanel() == "urn:sidebar:panel:search") + isOpen = true; + } + + return isOpen; Above simplifies to: return (!sidebar_is_hidden() && !sidebar_is_collapsed() && SidebarGetLastSelectedPanel() == "urn:sidebar:panel:search"); Same comment applies to function SidebarGetLastSelectedPanel
thats totally unreadable.
sorry, I didn't offer a better solution though :) hmm. how about: function sidebar_is_visible() { return !sidebar_is_hidden() && !sidebar_is_collapsed(); } function sidebar_search_is_last_visited() { return (SidebarGetLastSelectedPanel() == "urn:sidebar:panel:search"); } ... return sidebar_is_visible() && sidebar_search_is_last_visited(); that reads well, anyway :)
Well I don't think it totally unreadable! Simple "ands" three booleans. But I do like your solution better. If samir makes that change, then r=morse.
OK, so what is the cost of making the function calls vs. the if blocks cause we are trading one for the other?
OK, so I spoke to rogerl about this: he says the cost of two extra function calls is greater than the cost of the two "if blocks" (even though the current js inlines "small" functions). So if the two "if blocks" are considered just as readable as the function calls then we should use my original patch. If we care more about performance than readability in this case then we should use Steve's patch. My opinion is that my patch seems like a nice compromise between the two: it's fairly readable I think. alecf, morse?
this isn't called from a loop right? I'd say go with the readable solution
You are right Alec: it isn't called from a loop. The function to update search results is essentially one of the page load listeners.
If you put a line break between each literal, you can make the single-if- statement version more readable. For example: return ( !sidebar_is_hidden() && !sidebar_is_collapsed() && SidebarGetLastSelectedPanel() == "urn:sidebar:panel:search" ); By the way, it would be nice if it didn't take three function calls to sidebar code just to get the answer to "What panel is visited (if any)?".
Fwiw, I think if (a && b && c) is easier to read quickly than if (a && b) if (c) In the second, you have to remember that conjunction and nested ifs are equivalent, and mentally convert the two lines into three nested ifs or a conjunction of three literals.
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
mass-verifying claudius' Fixed bugs which haven't changed since 2001.12.31. if you think this particular bug is not fixed, please make sure of the following before reopening: a. retest with a *recent* trunk build. b. query bugzilla to see if there's an existing, open bug (new, reopened, assigned) that covers your issue. c. if this does need to be reopened, make sure there are specific steps to reproduce (unless already provided and up-to-date). thanks! [set your search string in mail to "AmbassadorKoshNaranek" to filter out these messages.]
Status: RESOLVED → VERIFIED
Product: Core → SeaMonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: