diff options
| author | 2013-10-23 16:24:40 -0700 | |
|---|---|---|
| committer | 2013-10-29 12:01:28 -0700 | |
| commit | 88474b416eb257078e590bf9bc7957cee604a186 (patch) | |
| tree | 7c59aa370bec9b0f2d37cb7a96d3b2effb3d92ce /test/InterfaceTest/InterfaceTest.java | |
| parent | 9780099e445884d8bc9444c8c1261b02d80a26c7 (diff) | |
Implement Interface Method Tables (IMT).
Change-Id: Idf7fe85e1293453a8ad862ff2380dcd5db4e3a39
Diffstat (limited to 'test/InterfaceTest/InterfaceTest.java')
| -rw-r--r-- | test/InterfaceTest/InterfaceTest.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/InterfaceTest/InterfaceTest.java b/test/InterfaceTest/InterfaceTest.java new file mode 100644 index 0000000000..ed18eb3dc7 --- /dev/null +++ b/test/InterfaceTest/InterfaceTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.Map; +import java.util.HashMap; + +class InterfaceTest { + + public static long test_virtual(HashMap map) { + Integer intobj = new Integer(0); + String s = "asdf"; + long start = System.currentTimeMillis(); + for (int i = 0; i < 1000000; i++) { + map.put(intobj, s); + } + long end = System.currentTimeMillis(); + return (end - start); + } + + public static long test_interface(Map map) { + Integer intobj = new Integer(0); + String s = "asdf"; + long start = System.currentTimeMillis(); + for (int i = 0; i < 1000000; i++) { + map.put(intobj, s); + } + long end = System.currentTimeMillis(); + return (end - start); + } + + public static void main(String[] args) { + HashMap hashmap = new HashMap(); + long elapsed = test_virtual(hashmap); + System.logI("virtual map put: " + elapsed); + hashmap.clear(); + + elapsed = test_interface(hashmap); + System.logI("interface map put: " + elapsed); + } +} |