Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8269581

optimize C2 lookupswitch/tableswitch

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      testet JDK11, JDK15, JDK17, Windows 10 x86 64Bit.

      A DESCRIPTION OF THE PROBLEM :
      Java switch-case statements are compiled to lookupswitch or tableswitch java bytecode. It is expected that for n cases the performance is O(1) for tableswitch and at least O(log(n)) for lookupswitch (see https://stackoverflow.com/questions/10287700/difference-between-jvms-lookupswitch-and-tableswitch). The truth is both are equaly good (C2 level 4) or bad (C2 level 3): For TieredStopAtLevel=3 the switch performance is O(n) :-(.
      The problem is that for very big n the code will never reach level 4 but is still slow/hotspot. (real world use case is a java compiler with ~1000 cases per switch - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=574361)

      A possible improvement may be to trigger level 4 after fewer runs for switches with many cases. To get a real O(1) the number of runs needed to get to level 4 would be antiproportional to the number of switch cases. i.e. each case statement should count as a normal run even if the case is not taken.

      jmh benchmark to proof O(n) behaviour on level 3:
      package benchmarks;

      import java.io.IOException;

      import org.openjdk.jmh.annotations.Benchmark;
      import org.openjdk.jmh.annotations.BenchmarkMode;
      import org.openjdk.jmh.annotations.Fork;
      import org.openjdk.jmh.annotations.Measurement;
      import org.openjdk.jmh.annotations.OutputTimeUnit;
      import org.openjdk.jmh.annotations.Setup;
      import org.openjdk.jmh.annotations.State;
      import org.openjdk.jmh.annotations.Warmup;
      import org.openjdk.jmh.runner.Runner;
      import org.openjdk.jmh.runner.RunnerException;
      import org.openjdk.jmh.runner.options.Options;
      import org.openjdk.jmh.runner.options.OptionsBuilder;

      @BenchmarkMode(org.openjdk.jmh.annotations.Mode.AverageTime)
      @OutputTimeUnit(java.util.concurrent.TimeUnit.NANOSECONDS)
      @State(org.openjdk.jmh.annotations.Scope.Thread)
      @Warmup(time = 2000, timeUnit = java.util.concurrent.TimeUnit.NANOSECONDS, iterations = 200)
      @Measurement(time = 2000, timeUnit = java.util.concurrent.TimeUnit.NANOSECONDS, iterations = 200)
      public class Switch {
      int my_int;

      @Setup
      public void setup() {
      my_int = 255;
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=3" })
      public int branch3() throws IOException {
      return branch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=4" })
      public int branch4() throws IOException {
      return branch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=3" })
      public int halfSwitch3() throws IOException {
      return halfSwitch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=4" })
      public int halfSwitch4() throws IOException {
      return halfSwitch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=3" })
      public int lookupswitch3() throws IOException {
      return lookupswitch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=4" })
      public int lookupswitch4() throws IOException {
      return lookupswitch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=3" })
      public int tableswitch3() throws IOException {
      return tableswitch();
      }

      @Benchmark
      @Fork(value = 1, jvmArgsAppend = { "-ea", "-XX:TieredStopAtLevel=4" })
      public int tableswitch4() throws IOException {
      return tableswitch();
      }

      public int branch() throws IOException {
      if (my_int == 1) {
      return 99999;
      }
      return 0;
      }

      public int lookupswitch() throws IOException {
      switch (my_int) {
      case 1:
      return 99999;
      case 2:
      return 99998;
      case 3:
      return 99997;
      case 4:
      return 99996;
      case 5:
      return 99995;
      case 6:
      return 99994;
      case 7:
      return 99993;
      case 8:
      return 99992;
      case 9:
      return 99991;
      case 10:
      return 99990;
      case 11:
      return 99989;
      case 12:
      return 99988;
      case 13:
      return 99987;
      case 14:
      return 99986;
      case 15:
      return 99985;
      case 16:
      return 99984;
      case 17:
      return 99983;
      case 18:
      return 99982;
      case 19:
      return 99981;
      case 20:
      return 99980;
      case 21:
      return 99979;
      case 22:
      return 99978;
      case 23:
      return 99977;
      case 24:
      return 99976;
      case 25:
      return 99975;
      case 26:
      return 99974;
      case 27:
      return 99973;
      case 28:
      return 99972;
      case 29:
      return 99971;
      case 30:
      return 99970;
      case 31:
      return 99969;
      case 32:
      return 99968;
      case 33:
      return 99967;
      case 34:
      return 99966;
      case 35:
      return 99965;
      case 36:
      return 99964;
      case 37:
      return 99963;
      case 38:
      return 99962;
      case 39:
      return 99961;
      case 40:
      return 99960;
      case 41:
      return 99959;
      case 42:
      return 99958;
      case 43:
      return 99957;
      case 44:
      return 99956;
      case 45:
      return 99955;
      case 46:
      return 99954;
      case 47:
      return 99953;
      case 48:
      return 99952;
      case 49:
      return 99951;
      case 50:
      return 99950;
      case 51:
      return 99949;
      case 52:
      return 99948;
      case 53:
      return 99947;
      case 54:
      return 99946;
      case 55:
      return 99945;
      case 56:
      return 99944;
      case 57:
      return 99943;
      case 58:
      return 99942;
      case 59:
      return 99941;
      case 60:
      return 99940;
      case 61:
      return 99939;
      case 62:
      return 99938;
      case 63:
      return 99937;
      case 64:
      return 99936;
      case 65:
      return 99935;
      case 66:
      return 99934;
      case 67:
      return 99933;
      case 68:
      return 99932;
      case 69:
      return 99931;
      case 70:
      return 99930;
      case 71:
      return 99929;
      case 72:
      return 99928;
      case 73:
      return 99927;
      case 74:
      return 99926;
      case 75:
      return 99925;
      case 76:
      return 99924;
      case 77:
      return 99923;
      case 78:
      return 99922;
      case 79:
      return 99921;
      case 80:
      return 99920;
      case 81:
      return 99919;
      case 82:
      return 99918;
      case 83:
      return 99917;
      case 84:
      return 99916;
      case 85:
      return 99915;
      case 86:
      return 99914;
      case 87:
      return 99913;
      case 88:
      return 99912;
      case 89:
      return 99911;
      case 90:
      return 99910;
      case 91:
      return 99909;
      case 92:
      return 99908;
      case 93:
      return 99907;
      case 94:
      return 99906;
      case 95:
      return 99905;
      case 96:
      return 99904;
      case 97:
      return 99903;
      case 98:
      return 99902;
      case 99:
      return 99901;
      case 100:
      return 99900;
      case 101:
      return 99899;
      case 102:
      return 99898;
      case 103:
      return 99897;
      case 104:
      return 99896;
      case 105:
      return 99895;
      case 106:
      return 99894;
      case 107:
      return 99893;
      case 108:
      return 99892;
      case 109:
      return 99891;
      case 110:
      return 99890;
      case 111:
      return 99889;
      case 112:
      return 99888;
      case 113:
      return 99887;
      case 114:
      return 99886;
      case 115:
      return 99885;
      case 116:
      return 99884;
      case 117:
      return 99883;
      case 118:
      return 99882;
      case 119:
      return 99881;
      case 120:
      return 99880;
      case 121:
      return 99879;
      case 122:
      return 99878;
      case 123:
      return 99877;
      case 124:
      return 99876;
      case 125:
      return 99875;
      case 126:
      return 99874;
      case 127:
      return 99873;
      case 128:
      return 99872;
      case 129:
      return 99871;
      case 130:
      return 99870;
      case 131:
      return 99869;
      case 132:
      return 99868;
      case 133:
      return 99867;
      case 134:
      return 99866;
      case 135:
      return 99865;
      case 136:
      return 99864;
      case 137:
      return 99863;
      case 138:
      return 99862;
      case 139:
      return 99861;
      case 140:
      return 99860;
      case 141:
      return 99859;
      case 142:
      return 99858;
      case 143:
      return 99857;
      case 144:
      return 99856;
      case 145:
      return 99855;
      case 146:
      return 99854;
      case 147:
      return 99853;
      case 148:
      return 99852;
      case 149:
      return 99851;
      case 150:
      return 99850;
      case 151:
      return 99849;
      case 152:
      return 99848;
      case 153:
      return 99847;
      case 154:
      return 99846;
      case 155:
      return 99845;
      case 156:
      return 99844;
      case 157:
      return 99843;
      case 158:
      return 99842;
      case 159:
      return 99841;
      case 160:
      return 99840;
      case 161:
      return 99839;
      case 162:
      return 99838;
      case 163:
      return 99837;
      case 164:
      return 99836;
      case 165:
      return 99835;
      case 166:
      return 99834;
      case 167:
      return 99833;
      case 168:
      return 99832;
      case 169:
      return 99831;
      case 170:
      return 99830;
      case 171:
      return 99829;
      case 172:
      return 99828;
      case 173:
      return 99827;
      case 174:
      return 99826;
      case 175:
      return 99825;
      case 176:
      return 99824;
      case 177:
      return 99823;
      case 178:
      return 99822;
      case 179:
      return 99821;
      case 180:
      return 99820;
      case 181:
      return 99819;
      case 182:
      return 99818;
      case 183:
      return 99817;
      case 184:
      return 99816;
      case 185:
      return 99815;
      case 186:
      return 99814;
      case 187:
      return 99813;
      case 188:
      return 99812;
      case 189:
      return 99811;
      case 190:
      return 99810;
      case 191:
      return 99809;
      case 192:
      return 99808;
      case 193:
      return 99807;
      case 194:
      return 99806;
      case 195:
      return 99805;
      case 196:
      return 99804;
      case 197:
      return 99803;
      case 198:
      return 99802;
      case 199:
      return 99801;
      case 200:
      return 99800;
      case 201:
      return 99799;
      case 202:
      return 99798;
      case 203:
      return 99797;
      case 204:
      return 99796;
      case 205:
      return 99795;
      case 206:
      return 99794;
      case 207:
      return 99793;
      case 208:
      return 99792;
      case 209:
      return 99791;
      case 210:
      return 99790;
      case 211:
      return 99789;
      case 212:
      return 99788;
      case 213:
      return 99787;
      case 214:
      return 99786;
      case 215:
      return 99785;
      case 216:
      return 99784;
      case 217:
      return 99783;
      case 218:
      return 99782;
      case 219:
      return 99781;
      case 220:
      return 99780;
      case 221:
      return 99779;
      case 222:
      return 99778;
      case 223:
      return 99777;
      case 224:
      return 99776;
      case 225:
      return 99775;
      case 226:
      return 99774;
      case 227:
      return 99773;
      case 228:
      return 99772;
      case 229:
      return 99771;
      case 230:
      return 99770;
      case 231:
      return 99769;
      case 232:
      return 99768;
      case 233:
      return 99767;
      case 234:
      return 99766;
      case 235:
      return 99765;
      case 236:
      return 99764;
      case 237:
      return 99763;
      case 238:
      return 99762;
      case 239:
      return 99761;
      case 240:
      return 99760;
      case 241:
      return 99759;
      case 242:
      return 99758;
      case 243:
      return 99757;
      case 244:
      return 99756;
      case 245:
      return 99755;
      case 246:
      return 99754;
      case 247:
      return 99753;
      case 248:
      return 99752;
      case 249:
      return 99751;
      case 250:
      return 99750;
      case 251:
      return 99749;
      case 252:
      return 99748;
      case 253:
      return 99747;
      case 10000:
      return 99746;
      }
      return 0;
      }

      public int halfSwitch() throws IOException {
      switch (my_int) {
      case 115:
      return 99885;
      case 116:
      return 99884;
      case 117:
      return 99883;
      case 118:
      return 99882;
      case 119:
      return 99881;
      case 120:
      return 99880;
      case 121:
      return 99879;
      case 122:
      return 99878;
      case 123:
      return 99877;
      case 124:
      return 99876;
      case 125:
      return 99875;
      case 126:
      return 99874;
      case 127:
      return 99873;
      case 128:
      return 99872;
      case 129:
      return 99871;
      case 130:
      return 99870;
      case 131:
      return 99869;
      case 132:
      return 99868;
      case 133:
      return 99867;
      case 134:
      return 99866;
      case 135:
      return 99865;
      case 136:
      return 99864;
      case 137:
      return 99863;
      case 138:
      return 99862;
      case 139:
      return 99861;
      case 140:
      return 99860;
      case 141:
      return 99859;
      case 142:
      return 99858;
      case 143:
      return 99857;
      case 144:
      return 99856;
      case 145:
      return 99855;
      case 146:
      return 99854;
      case 147:
      return 99853;
      case 148:
      return 99852;
      case 149:
      return 99851;
      case 150:
      return 99850;
      case 151:
      return 99849;
      case 152:
      return 99848;
      case 153:
      return 99847;
      case 154:
      return 99846;
      case 155:
      return 99845;
      case 156:
      return 99844;
      case 157:
      return 99843;
      case 158:
      return 99842;
      case 159:
      return 99841;
      case 160:
      return 99840;
      case 161:
      return 99839;
      case 162:
      return 99838;
      case 163:
      return 99837;
      case 164:
      return 99836;
      case 165:
      return 99835;
      case 166:
      return 99834;
      case 167:
      return 99833;
      case 168:
      return 99832;
      case 169:
      return 99831;
      case 170:
      return 99830;
      case 171:
      return 99829;
      case 172:
      return 99828;
      case 173:
      return 99827;
      case 174:
      return 99826;
      case 175:
      return 99825;
      case 176:
      return 99824;
      case 177:
      return 99823;
      case 178:
      return 99822;
      case 179:
      return 99821;
      case 180:
      return 99820;
      case 181:
      return 99819;
      case 182:
      return 99818;
      case 183:
      return 99817;
      case 184:
      return 99816;
      case 185:
      return 99815;
      case 186:
      return 99814;
      case 187:
      return 99813;
      case 188:
      return 99812;
      case 189:
      return 99811;
      case 190:
      return 99810;
      case 191:
      return 99809;
      case 192:
      return 99808;
      case 193:
      return 99807;
      case 194:
      return 99806;
      case 195:
      return 99805;
      case 196:
      return 99804;
      case 197:
      return 99803;
      case 198:
      return 99802;
      case 199:
      return 99801;
      case 200:
      return 99800;
      case 201:
      return 99799;
      case 202:
      return 99798;
      case 203:
      return 99797;
      case 204:
      return 99796;
      case 205:
      return 99795;
      case 206:
      return 99794;
      case 207:
      return 99793;
      case 208:
      return 99792;
      case 209:
      return 99791;
      case 210:
      return 99790;
      case 211:
      return 99789;
      case 212:
      return 99788;
      case 213:
      return 99787;
      case 214:
      return 99786;
      case 215:
      return 99785;
      case 216:
      return 99784;
      case 217:
      return 99783;
      case 218:
      return 99782;
      case 219:
      return 99781;
      case 220:
      return 99780;
      case 221:
      return 99779;
      case 222:
      return 99778;
      case 223:
      return 99777;
      case 224:
      return 99776;
      case 225:
      return 99775;
      case 226:
      return 99774;
      case 227:
      return 99773;
      case 228:
      return 99772;
      case 229:
      return 99771;
      case 230:
      return 99770;
      case 231:
      return 99769;
      case 232:
      return 99768;
      case 233:
      return 99767;
      case 234:
      return 99766;
      case 235:
      return 99765;
      case 236:
      return 99764;
      case 237:
      return 99763;
      case 238:
      return 99762;
      case 239:
      return 99761;
      case 240:
      return 99760;
      case 241:
      return 99759;
      case 242:
      return 99758;
      case 243:
      return 99757;
      case 244:
      return 99756;
      case 245:
      return 99755;
      case 246:
      return 99754;
      case 247:
      return 99753;
      case 248:
      return 99752;
      case 249:
      return 99751;
      case 250:
      return 99750;
      case 251:
      return 99749;
      case 252:
      return 99748;
      case 253:
      return 99747;
      case 256:
      return 99746;
      }
      return 0;
      }

      public int tableswitch() throws IOException {
      switch (my_int) {
      case 1:
      return 99999;
      case 2:
      return 99998;
      case 3:
      return 99997;
      case 4:
      return 99996;
      case 5:
      return 99995;
      case 6:
      return 99994;
      case 7:
      return 99993;
      case 8:
      return 99992;
      case 9:
      return 99991;
      case 10:
      return 99990;
      case 11:
      return 99989;
      case 12:
      return 99988;
      case 13:
      return 99987;
      case 14:
      return 99986;
      case 15:
      return 99985;
      case 16:
      return 99984;
      case 17:
      return 99983;
      case 18:
      return 99982;
      case 19:
      return 99981;
      case 20:
      return 99980;
      case 21:
      return 99979;
      case 22:
      return 99978;
      case 23:
      return 99977;
      case 24:
      return 99976;
      case 25:
      return 99975;
      case 26:
      return 99974;
      case 27:
      return 99973;
      case 28:
      return 99972;
      case 29:
      return 99971;
      case 30:
      return 99970;
      case 31:
      return 99969;
      case 32:
      return 99968;
      case 33:
      return 99967;
      case 34:
      return 99966;
      case 35:
      return 99965;
      case 36:
      return 99964;
      case 37:
      return 99963;
      case 38:
      return 99962;
      case 39:
      return 99961;
      case 40:
      return 99960;
      case 41:
      return 99959;
      case 42:
      return 99958;
      case 43:
      return 99957;
      case 44:
      return 99956;
      case 45:
      return 99955;
      case 46:
      return 99954;
      case 47:
      return 99953;
      case 48:
      return 99952;
      case 49:
      return 99951;
      case 50:
      return 99950;
      case 51:
      return 99949;
      case 52:
      return 99948;
      case 53:
      return 99947;
      case 54:
      return 99946;
      case 55:
      return 99945;
      case 56:
      return 99944;
      case 57:
      return 99943;
      case 58:
      return 99942;
      case 59:
      return 99941;
      case 60:
      return 99940;
      case 61:
      return 99939;
      case 62:
      return 99938;
      case 63:
      return 99937;
      case 64:
      return 99936;
      case 65:
      return 99935;
      case 66:
      return 99934;
      case 67:
      return 99933;
      case 68:
      return 99932;
      case 69:
      return 99931;
      case 70:
      return 99930;
      case 71:
      return 99929;
      case 72:
      return 99928;
      case 73:
      return 99927;
      case 74:
      return 99926;
      case 75:
      return 99925;
      case 76:
      return 99924;
      case 77:
      return 99923;
      case 78:
      return 99922;
      case 79:
      return 99921;
      case 80:
      return 99920;
      case 81:
      return 99919;
      case 82:
      return 99918;
      case 83:
      return 99917;
      case 84:
      return 99916;
      case 85:
      return 99915;
      case 86:
      return 99914;
      case 87:
      return 99913;
      case 88:
      return 99912;
      case 89:
      return 99911;
      case 90:
      return 99910;
      case 91:
      return 99909;
      case 92:
      return 99908;
      case 93:
      return 99907;
      case 94:
      return 99906;
      case 95:
      return 99905;
      case 96:
      return 99904;
      case 97:
      return 99903;
      case 98:
      return 99902;
      case 99:
      return 99901;
      case 100:
      return 99900;
      case 101:
      return 99899;
      case 102:
      return 99898;
      case 103:
      return 99897;
      case 104:
      return 99896;
      case 105:
      return 99895;
      case 106:
      return 99894;
      case 107:
      return 99893;
      case 108:
      return 99892;
      case 109:
      return 99891;
      case 110:
      return 99890;
      case 111:
      return 99889;
      case 112:
      return 99888;
      case 113:
      return 99887;
      case 114:
      return 99886;
      case 115:
      return 99885;
      case 116:
      return 99884;
      case 117:
      return 99883;
      case 118:
      return 99882;
      case 119:
      return 99881;
      case 120:
      return 99880;
      case 121:
      return 99879;
      case 122:
      return 99878;
      case 123:
      return 99877;
      case 124:
      return 99876;
      case 125:
      return 99875;
      case 126:
      return 99874;
      case 127:
      return 99873;
      case 128:
      return 99872;
      case 129:
      return 99871;
      case 130:
      return 99870;
      case 131:
      return 99869;
      case 132:
      return 99868;
      case 133:
      return 99867;
      case 134:
      return 99866;
      case 135:
      return 99865;
      case 136:
      return 99864;
      case 137:
      return 99863;
      case 138:
      return 99862;
      case 139:
      return 99861;
      case 140:
      return 99860;
      case 141:
      return 99859;
      case 142:
      return 99858;
      case 143:
      return 99857;
      case 144:
      return 99856;
      case 145:
      return 99855;
      case 146:
      return 99854;
      case 147:
      return 99853;
      case 148:
      return 99852;
      case 149:
      return 99851;
      case 150:
      return 99850;
      case 151:
      return 99849;
      case 152:
      return 99848;
      case 153:
      return 99847;
      case 154:
      return 99846;
      case 155:
      return 99845;
      case 156:
      return 99844;
      case 157:
      return 99843;
      case 158:
      return 99842;
      case 159:
      return 99841;
      case 160:
      return 99840;
      case 161:
      return 99839;
      case 162:
      return 99838;
      case 163:
      return 99837;
      case 164:
      return 99836;
      case 165:
      return 99835;
      case 166:
      return 99834;
      case 167:
      return 99833;
      case 168:
      return 99832;
      case 169:
      return 99831;
      case 170:
      return 99830;
      case 171:
      return 99829;
      case 172:
      return 99828;
      case 173:
      return 99827;
      case 174:
      return 99826;
      case 175:
      return 99825;
      case 176:
      return 99824;
      case 177:
      return 99823;
      case 178:
      return 99822;
      case 179:
      return 99821;
      case 180:
      return 99820;
      case 181:
      return 99819;
      case 182:
      return 99818;
      case 183:
      return 99817;
      case 184:
      return 99816;
      case 185:
      return 99815;
      case 186:
      return 99814;
      case 187:
      return 99813;
      case 188:
      return 99812;
      case 189:
      return 99811;
      case 190:
      return 99810;
      case 191:
      return 99809;
      case 192:
      return 99808;
      case 193:
      return 99807;
      case 194:
      return 99806;
      case 195:
      return 99805;
      case 196:
      return 99804;
      case 197:
      return 99803;
      case 198:
      return 99802;
      case 199:
      return 99801;
      case 200:
      return 99800;
      case 201:
      return 99799;
      case 202:
      return 99798;
      case 203:
      return 99797;
      case 204:
      return 99796;
      case 205:
      return 99795;
      case 206:
      return 99794;
      case 207:
      return 99793;
      case 208:
      return 99792;
      case 209:
      return 99791;
      case 210:
      return 99790;
      case 211:
      return 99789;
      case 212:
      return 99788;
      case 213:
      return 99787;
      case 214:
      return 99786;
      case 215:
      return 99785;
      case 216:
      return 99784;
      case 217:
      return 99783;
      case 218:
      return 99782;
      case 219:
      return 99781;
      case 220:
      return 99780;
      case 221:
      return 99779;
      case 222:
      return 99778;
      case 223:
      return 99777;
      case 224:
      return 99776;
      case 225:
      return 99775;
      case 226:
      return 99774;
      case 227:
      return 99773;
      case 228:
      return 99772;
      case 229:
      return 99771;
      case 230:
      return 99770;
      case 231:
      return 99769;
      case 232:
      return 99768;
      case 233:
      return 99767;
      case 234:
      return 99766;
      case 235:
      return 99765;
      case 236:
      return 99764;
      case 237:
      return 99763;
      case 238:
      return 99762;
      case 239:
      return 99761;
      case 240:
      return 99760;
      case 241:
      return 99759;
      case 242:
      return 99758;
      case 243:
      return 99757;
      case 244:
      return 99756;
      case 245:
      return 99755;
      case 246:
      return 99754;
      case 247:
      return 99753;
      case 248:
      return 99752;
      case 249:
      return 99751;
      case 250:
      return 99750;
      case 251:
      return 99749;
      case 252:
      return 99748;
      case 253:
      return 99747;
      case 256:
      return 99746;
      }
      return 0;
      }

      public static void main(String[] args) throws RunnerException, InterruptedException {
      Options opt = new OptionsBuilder().include(Switch.class.getSimpleName()).shouldFailOnError(true).build();
      new Runner(opt).run();
      }


      //Benchmark Mode Cnt Score Error Units
      //Switch.branch3 avgt 200 15,913 ± 1,305 ns/op
      //Switch.halfSwitch3 avgt 200 115,540 ± 8,991 ns/op
      //Switch.lookupswitch3 avgt 200 220,859 ± 19,078 ns/op
      //Switch.tableswitch3 avgt 200 218,981 ± 22,573 ns/op
      //Switch.branch4 avgt 200 2,588 ± 0,236 ns/op
      //Switch.lookupswitch4 avgt 200 4,022 ± 0,461 ns/op
      //Switch.tableswitch4 avgt 200 3,450 ± 0,295 ns/op
      }




        Attachments

          Activity

            People

            Assignee:
            chagedorn Christian Hagedorn
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: