For a C# simulation software module (3D mesh), I have a switch/case block consisting of 3^6 cases (3 conditions for 6 neighbours each). Along with the content, which is roughly the same size for each block, it results in about 9000 LoC.
Given the number of different conditions, I doubt that there is anything more performant than doing this with switch/case, and when running it, it's reasonably fast. However, on the first call, the programme freezes for several seconds. When repeating the calculations without restarting the software, it stays fast. This effect is the same for Debug and Release.
The accepted answer in Is "else if" faster than "switch() case"? states that switch/case is implemented through a hash list. Is this list really created at runtime? If so, can it be optimised somehow so it doesn't take several seconds at each launch? If not, where does the time delay come from? (I already checked that the delay is gone when commenting out the switch/case block.)
Any help or hints would be much appreciated!