This project is read-only.

Switch(Type) > 4

Feb 2, 2012 at 8:32 AM

How are the chances, that switch statements support more than 4 cases somewhere new in the future?

Feb 2, 2012 at 8:36 AM
switch statements on what datatype?
Please have a look at how it's implemented: strings use a list and then string.compare, which is not yet implemented i think...


On Thu, Feb 2, 2012 at 9:32 AM, YukiFX <notifications@codeplex.com> wrote:

From: YukiFX

How are the chances, that switch statements support more than 4 cases somewhere new in the future?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Feb 2, 2012 at 1:53 PM

What do you mean by more than 4 cases? The switch op-code is implemented for any number of case statements. (Although they currently don't perform much faster than normal if-elseif statments, because we don't currently build a jump table for it.)

Feb 2, 2012 at 1:55 PM
On 2/2/2012 9:53 AM, blah38621 wrote:
> What do you mean by more than 4 cases? The switch op-code is implemented
> for any number of case statements. (Although they currently don't
> perform much faster than normal if-elseif statments, because we don't
> currently build a jump table for it.)

The C# compiler optimizer changes IL output after 4 item with some
types, most notably strings. This is likely the cause.
Feb 2, 2012 at 1:56 PM
Cases on strings are implemented using strings to speed up things. Smaller int-based switch statements use integers if i recall correctly...


On Thu, Feb 2, 2012 at 2:53 PM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

What do you mean by more than 4 cases? The switch op-code is implemented for any number of case statements. (Although they currently don't perform much faster than normal if-elseif statments, because we don't currently build a jump table for it.)

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Feb 2, 2012 at 3:04 PM

I must have missed that you implemented them...

I recall sometime back in th epast, switch´s could only handle up to 4 cases as it was limited by the IL2CPU.

 

Switch(xyz)
case 1:
case 2:

...

.

.

 

Feb 2, 2012 at 3:09 PM
well, not directly limited by our compiler, it's how the c# compiler handles them (using lists, etc)


On Thu, Feb 2, 2012 at 4:05 PM, YukiFX <notifications@codeplex.com> wrote:

From: YukiFX

I must have missed that you implemented them...

I recall sometime back in th epast, switch´s could only handle up to 4 cases as it was limited by the IL2CPU.

Switch(xyz)
case 1:
case 2:

...

.

.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com