[Mono-bugs] [Bug 655380] String switch statement 2x slower if compared to simple list of if statements

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 23 13:20:33 EST 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=655380#c17


--- Comment #17 from Zoltan Varga <vargaz at gmail.com> 2010-11-23 18:20:32 UTC ---
On my tegra, the timings are:

Switch 2910
If 566

The hash table based implementation does lots of work under the hood:
- it makes a couple of method calls instead of the approximately 1-2 calls the
  if based implementation does
- it computes the hash code of the input string which is not very fast, even on
x86.
- it iterates over the hash table
- it does a final string comparison on the item found in the hash table

So this will be slower on all architectures, it just happens to be much slower
on arm.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list