Re: [Banshee-List] [banshee] Show multi-line strings on one line in the ColumnCellText (bgo#591802)
- From: Alexander Kojevnikov <alexander kojevnikov com>
- To: banshee-list gnome org
- Subject: Re: [Banshee-List] [banshee] Show multi-line strings on one line in the ColumnCellText (bgo#591802)
- Date: Fri, 11 Sep 2009 10:42:29 +1000
2009/9/11 Bertrand Lorentz <bertrand lorentz free fr>:
> Hi,
>
> I'm a bit late, but I'd like to point that the patch below potentially
> causes a lot of additional method calls and string allocations.
>
> I did a quick profiling session, doing these actions : start banshee,
> scroll the listview of my whole library (about 2000 tracks), quit
> banshee.
> Here are the relevant parts of the "mono --profile" output.
>
> Before the patch :
>
> Time(ms) Count P/call(ms) Method name
> ########################
> 44.652 14484 0.003 System.String::Replace(string,string)
> Callers (with count) that contribute at least for 1%:
> 14032 96 %
> NDesk.DBus.MatchRule::Append(StringBuilder,string,string)
> 248 1 %
> Mono.Addins.Database.ProcessProgressStatus::Decode(string)
> 149 1 %
> Banshee.GnomeBackend.GConfConfigurationClient::CreateKey(string,string)
>
> Total mem Method
> ########################
> 933 KB System.String::ReplaceUnchecked(string,string)
> 933 KB 14335
> System.String
> Callers (with count) that contribute at least for 1%:
> 14484 100 % System.String::Replace(string,string)
>
>
>
> After the patch :
>
> Time(ms) Count P/call(ms) Method name
> ########################
> 221.986 110715 0.002 System.String::Replace(string,string)
> Callers (with count) that contribute at least for 1%:
> 96231 86 %
> Hyena.Data.Gui.ColumnCellText::UpdateLayout(Layout,string)
> 14032 12 %
> NDesk.DBus.MatchRule::Append(StringBuilder,string,string)
>
> Total mem Method
> ########################
> 1833 KB System.String::ReplaceUnchecked(string,string)
> 1833 KB 42548
> System.String
> Callers (with count) that contribute at least for 1%:
> 110715 100 % System.String::Replace(string,string)
>
>
> This is of course very un-scientific, but I thought I'd throw it out
> there, so that maybe someone would come up with a way to optimize this.
>
Thanks Bertrand, I didn't know about the --profile option, it looks very useful.
I tried to substitute the String.Replace with a Regex.Replace using a
pre-compiled regex. This ends up being an order of magnitude slower.
However, if I check the string for \r or \n using
String.IndexOfAny(char[]), the results are much better. I will commit
this, let me know if you see different results.
Cheers,
Alex
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]