jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
changeset 27785 29d4cb4a8f5e
parent 5506 202f599c92aa
equal deleted inserted replaced
27784:a51d6d4e0528 27785:29d4cb4a8f5e
   180             new Job("write into array") { void work() {
   180             new Job("write into array") { void work() {
   181                 Object[] a = new Integer[1];
   181                 Object[] a = new Integer[1];
   182                 for (int i = 0; i < iterations; i++) {
   182                 for (int i = 0; i < iterations; i++) {
   183                     for (Object x : list.toArray()) {
   183                     for (Object x : list.toArray()) {
   184                         try { a[0] = x; }
   184                         try { a[0] = x; }
   185                         catch (ArrayStoreException _) {
   185                         catch (ArrayStoreException unused) {
   186                             throw new ClassCastException(); }}}}},
   186                             throw new ClassCastException(); }}}}},
   187             new Job("write into dynamic array") { void work() {
   187             new Job("write into dynamic array") { void work() {
   188                 for (int i = 0; i < iterations; i++) {
   188                 for (int i = 0; i < iterations; i++) {
   189                     for (Object x : list.toArray()) {
   189                     for (Object x : list.toArray()) {
   190                         Object[] a = (Object[])
   190                         Object[] a = (Object[])
   191                             java.lang.reflect.Array.newInstance(klazz, 1);
   191                             java.lang.reflect.Array.newInstance(klazz, 1);
   192                         try { a[0] = x; }
   192                         try { a[0] = x; }
   193                         catch (ArrayStoreException _) {
   193                         catch (ArrayStoreException unused) {
   194                             throw new ClassCastException(); }}}}}
   194                             throw new ClassCastException(); }}}}}
   195         };
   195         };
   196 
   196 
   197         time(filter(filter, jobs));
   197         time(filter(filter, jobs));
   198     }
   198     }