1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.databoard.tests;
\r
13 import java.util.concurrent.locks.ReentrantReadWriteLock;
\r
15 import org.simantics.databoard.Bindings;
\r
16 import org.simantics.databoard.binding.Binding;
\r
18 public class Jotakin6 {
\r
20 public static class X {
\r
21 public int[] array = new int[1024*1024*4];
\r
22 public long[] array2 = new long[1024*1024*4];
\r
25 public static class Y {
\r
28 public static void main(String[] args)
\r
31 ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
\r
33 lock.writeLock().lock();
\r
34 lock.readLock().lock();
\r
35 lock.readLock().unlock();
\r
36 lock.writeLock().unlock();
\r
39 Binding b = Bindings.getBinding(X.class);
\r
41 int hash = b.hashValue(x);
\r
43 long startTime = System.currentTimeMillis();
\r
45 hash = b.hashValue(x);
\r
47 long elapsedTime = System.currentTimeMillis() - startTime;
\r
49 System.out.println("hash="+hash+", time="+elapsedTime);
\r