Closed
Bug 221361
Opened 21 years ago
Closed 21 years ago
right click context speed is very slow with large selections
Categories
(SeaMonkey :: UI Design, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: bugzilla, Assigned: bugzilla)
References
()
Details
(Keywords: perf)
Attachments
(1 file, 3 obsolete files)
3.32 KB,
patch
|
neil
:
review+
alecf
:
superreview+
|
Details | Diff | Splinter Review |
go to http://brightonnewmedia.org/archives/2003-September.txt press CTRL + A to select all text right click on the page it takes forever to the context menu to show. 20031003
Comment 1•21 years ago
|
||
When the context menu comes up, it executes the following code: 785 var selection = this.searchSelected(); ... 792 if (searchSelectText.length > 15) 793 searchSelectText = searchSelectText.substr(0,15) + "..."; ... 797 searchSelectText = bundle.formatStringFromName("searchText", 798 [searchSelectText], 1); 799 this.setItemAttr("context-searchselect", "label", searchSelectText); where we have: 804 searchSelected : function() { 805 var focusedWindow = document.commandDispatcher.focusedWindow; 806 var searchStr = focusedWindow.__proto__.getSelection.call(focusedWindow); 807 searchStr = searchStr.toString(); 808 searchStr = searchStr.replace( /^\s+/, "" ); 809 searchStr = searchStr.replace(/(\n|\r|\t)+/g, " "); 810 searchStr = searchStr.replace(/\s+$/,""); 811 return searchStr; 812 }, So the problem is that the entire selection is stringified, then linearly search/replaced three times, before the first 15 chars are grabbed... This is bound to be slow with a large selection.
Assignee | ||
Updated•21 years ago
|
Summary: right click context speed is very slow → right click context speed is very slow with large selections
Assignee | ||
Comment 2•21 years ago
|
||
1st and 3th regexp can be made as one at least in perl: $str =~ s/^\s*(.*?)\s*$/$1/;
Assignee | ||
Comment 3•21 years ago
|
||
I can boil it down to two regexp: searchStr = searchStr.replace(/(\n|\r|\t)+/g, " "); searchStr = searchStr.replace(/\s*(.*?)\s*$/,"$1"); the one regexp that takes a long time is: searchStr = searchStr.replace(/(\n|\r|\t)+/g, " "); cant we just return if searchStr.lenght is larger than fx 150 chars? and then just take the first 150 chars and run through the regexps?
Assignee | ||
Comment 4•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #133404 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 5•21 years ago
|
||
how it works: 1) find the first 16 important chars but get the whole string 2) remove any tabs/newslines 3) remove leading and trailing spaces 4) replace multi whitespace with single whitespace
Assignee | ||
Updated•21 years ago
|
Attachment #133404 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Attachment #133408 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 6•21 years ago
|
||
Comment on attachment 133404 [details] [diff] [review] If the selection is larger than 150 chars cut if off for performance (clearing review request on obsolete patch)
Attachment #133404 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 7•21 years ago
|
||
added charlen so that max query to search engine is 2000 chars. try fx to load http://www.mozilla.org/start/ and select all (CTRL+A) and press "web search for ..." and you get "google error Bad Request"
Assignee | ||
Updated•21 years ago
|
Attachment #133408 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Attachment #133408 -
Flags: review?(neil.parkwaycc.co.uk)
Assignee | ||
Updated•21 years ago
|
Attachment #133415 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 8•21 years ago
|
||
Comment on attachment 133415 [details] [diff] [review] new patch fixing problems Why didn't you patch contentAreaContextMenu.xul to pass a length? > searchStr = searchStr.replace(/(\n|\r|\t)+/g, " "); This line is superfluous, your other regexps take care of it. Forwarding on the review to Jan because it affects Firebird.
Attachment #133415 -
Flags: review?(neil.parkwaycc.co.uk) → review?(varga)
Comment 9•21 years ago
|
||
Comment on attachment 133415 [details] [diff] [review] new patch fixing problems looks good to me r=varga with Neil's suggestions fixed
Attachment #133415 -
Flags: review?(varga) → review+
Assignee | ||
Comment 10•21 years ago
|
||
Attachment #133415 -
Attachment is obsolete: true
Updated•21 years ago
|
Attachment #133761 -
Flags: review+
Assignee | ||
Comment 11•21 years ago
|
||
I'm looking for sr and checkin for the patch. already emailed reviewer@mozilla.org twice! and nothing...
Assignee | ||
Updated•21 years ago
|
Attachment #133761 -
Flags: superreview?(blake)
Assignee | ||
Updated•21 years ago
|
Attachment #133761 -
Flags: superreview?(blake) → superreview?(alecf)
Comment 13•21 years ago
|
||
Comment on attachment 133761 [details] [diff] [review] new patch with Neils fixes neat, though kind of ugly that this function is in both browser.js and nsContextMenu.js - sure would be nice to consolidate! sr=alecf
Attachment #133761 -
Flags: superreview?(alecf) → superreview+
Comment 15•21 years ago
|
||
Alecf: the two routines do not belong to the same codebase. They are forked between Firebird and the suite.
Comment 16•21 years ago
|
||
That's a statement of fact. The question is, why does it *need* to be forked?
Comment 17•21 years ago
|
||
Comment on attachment 133761 [details] [diff] [review] new patch with Neils fixes checked in
Comment 18•21 years ago
|
||
Fixed with checkin from Jan Varga.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 19•20 years ago
|
||
Henrik: about searchStr = searchStr.replace(/\s*(.*?)\s*$/,"$1"): - Why not anchor at the front? - Why the ? for the .*? /be
Updated•20 years ago
|
Product: Core → Mozilla Application Suite
You need to log in
before you can comment on or make changes to this bug.
Description
•