Path: blob/master/test/jdk/java/beans/Performance/Test7184799.java
41149 views
/*1* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 7187618 718479926* @summary Tests just a benchmark of Introspector.getBeanInfo(Class) performance27* @author Sergey Malenkov28* @run main/manual Test718479929*/3031import java.beans.Introspector;32import java.util.*;33import java.util.concurrent.ConcurrentHashMap;3435public class Test7184799 {36private static final Class[] TYPES = {37Class.class,38String.class,39Character.class,40Boolean.class,41Byte.class,42Short.class,43Integer.class,44Long.class,45Float.class,46Double.class,47Collection.class,48Set.class,49HashSet.class,50TreeSet.class,51LinkedHashSet.class,52Map.class,53HashMap.class,54TreeMap.class,55LinkedHashMap.class,56WeakHashMap.class,57ConcurrentHashMap.class,58Dictionary.class,59Exception.class,60};6162public static void main(String[] args) throws Exception {63long time = System.nanoTime();64for (Class type : TYPES) {65Introspector.getBeanInfo(type);66}67time -= System.nanoTime();68System.out.println("Time (ms): " + (-time / 1000000));69}70}717273