Closed Bug 103451 Opened 23 years ago Closed 16 years ago

sorting performance: need GetSortKeyLen() and CreateRawSortKey() that take const PRUnichar * to avoid copying

Categories

(MailNews Core :: Backend, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 207634
Future

People

(Reporter: sspitzer, Unassigned)

Details

(Keywords: perf)

need GetSortKeyLen() and CreateRawSortKey() that take const PRUnichar * to 
avoid copying 

see nsMsgDatabase::CreateCollationKey()

also, it seems like we could fix GetSortKeyLen() and CreateRawSortKey().

GetSortKeyLen() does an allocation and so does CreateRawSortKey()?

why can't we use that allocation for CreateRawSortKey()?  maybe create a 
CreateRawSortKey() does it all in one go?

also, CreateRawSortKey() copies the string even if it doesn't normalize it.

176   nsAutoString stringNormalized; stringNormalized.Assign(stringIn);
178   if (mCollation != NULL && strength == kCollationCaseInSensitive) {
179     mCollation->NormalizeString(stringNormalized);
180   }
>need GetSortKeyLen() and CreateRawSortKey() that take const PRUnichar * to 
>avoid copying 
I saw a bug filed related to this. Cc to bstell, do you know the bug number?

>also, CreateRawSortKey() copies the string even if it doesn't normalize it.
Right, this can be improved.
Summary: sorting performance: need GetSortKeyLen() and CreateRawSortKey() that take const PRUnichar * to avoid copying → sorting performance: need GetSortKeyLen() and CreateRawSortKey() that take const PRUnichar * to avoid copying
It's bug 103222, changing to use nsAString.
Adding nsbeta1 nomination because I remember hearing discussion that this would
help a lot.  
Keywords: nsbeta1, perf
OS: Windows 2000 → All
QA Contact: esther → stephend
Hardware: PC → All
I heard nsDependentString does not copy. Can that be used in the mail code?
Keywords: nsbeta1nsbeta1+
Priority: -- → P2
Target Milestone: --- → mozilla0.9.7
reassigning to cavin.
Assignee: sspitzer → cavin
If we can get this in 0.9.7 that would be great, but moving to 0.9.8 since it
could wait
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Using 12-10 code base, Quantify log shows that nsMsgDBView::Sort only takes up
0.03% of the total sorting time (5 msgs, sort by subject):

Function:
nsMsgDBView::Sort
Calls:
1
Function time:	0.38 (0.00% of Focus)
F+D time:	194.64 (0.03% of Focus) (in ms)
Avg F time:	0.38
Min F time:	0.38
Max F time:	0.38

and the number of calls to GetSortKeyLen(), CreateRawSortKey() and PR_malloc()
(space allocation for the keys) is equal to the number of total msgs in the
folder. The time used by them is almost nothing (percentage wide).


  Function Name                   Calls   Time (in ms)
nsCollationWin::GetSortKeyLen       5       17.08
nsCollationWin::CreateRawSortKey    5       16.74
PR_Malloc                           5       9.01

Same thing for the time spent in windows LCMapStringW() calls:

  Function Name                  Calls   Time (in ms)
LCMapStringW                       10       28.81
moving to future based on Quantify data.
Target Milestone: mozilla0.9.8 → Future
Marking nsbeta1-
Keywords: nsbeta1+nsbeta1-
Perhaps you should take a look at bug 149605 and bug 159111.
Would fixing this bug fix those as well ?
Use of nsDependentString is covered by bug 207634.
Product: MailNews → Core
with bug 207634 fixed, is there anything worth keeping, considering comment 7?
Assignee: cavin → nobody
QA Contact: stephend → backend
Yeah, I guess 207634 fixes this after all.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.