https://bugzilla.novell.com/show_bug.cgi?id=354238

User [EMAIL PROTECTED] added comment
https://bugzilla.novell.com/show_bug.cgi?id=354238#c4





--- Comment #4 from Juraj Skripsky <[EMAIL PROTECTED]>  2008-01-17 07:14:50 MST 
---
Created an attachment (id=190848)
 --> (https://bugzilla.novell.com/attachment.cgi?id=190848)
performance test case

I've done a little performance testing. The attached program compares the
performance of a switch-no-string with a switch-on-dictionary<string,int>. It 
takes one argument - the string to feed into the switch.

The switch-no-string case is tested twice - the first time with non-interned
string, the second with interned string.

Results on Mono:

[EMAIL PROTECTED] ~]$ mono switch.exe Hello
Switch:     415710
IsInterned: 426250

 -- string is interned from now on --

IsInterned: 328600
Switch:     317760
DictSwitch: 188090


[EMAIL PROTECTED] ~]$ mono switch.exe xxxxxxxx
Switch:     602920
IsInterned: 671700

 -- string is interned from now on --

IsInterned: 383080
Switch:     360620
DictSwitch: 151780


Interestingly "DictSwitch" is faster even when an interned string is feed into
"Switch" _and_ the interned string is the first match. That's why I included a
performance test for "String.IsInterned".
It turns out that a switch-on-string spents most of its time in
"String.IsInterned"!


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to