Author: mes
Date: 2012-04-18 15:19:28 -0700 (Wed, 18 Apr 2012)
New Revision: 28881
Added:
core3/impl/trunk/model-impl/table-performance-debug/
core3/impl/trunk/model-impl/table-performance-debug/pom.xml
core3/impl/trunk/model-impl/table-performance-debug/src/
core3/impl/trunk/model-impl/table-performance-debug/src/main/
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/cytoscape/
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/cytoscape/model/
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/cytoscape/model/PerfTest.java
Modified:
core3/impl/trunk/model-impl/pom.xml
Log:
added table performance debug application
Modified: core3/impl/trunk/model-impl/pom.xml
===================================================================
--- core3/impl/trunk/model-impl/pom.xml 2012-04-18 21:27:25 UTC (rev 28880)
+++ core3/impl/trunk/model-impl/pom.xml 2012-04-18 22:19:28 UTC (rev 28881)
@@ -17,6 +17,7 @@
<module>performance</module>
-->
<module>performance-debug</module>
+ <module>table-performance-debug</module>
</modules>
Added: core3/impl/trunk/model-impl/table-performance-debug/pom.xml
===================================================================
--- core3/impl/trunk/model-impl/table-performance-debug/pom.xml
(rev 0)
+++ core3/impl/trunk/model-impl/table-performance-debug/pom.xml 2012-04-18
22:19:28 UTC (rev 28881)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <artifactId>model-impl-parent</artifactId>
+ <groupId>org.cytoscape</groupId>
+ <version>3.0.0-alpha8-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+
<bundle.symbolicName>org.cytoscape.model-impl-table-performance-debug</bundle.symbolicName>
+ <bundle.namespace>org.cytoscape.model</bundle.namespace>
+ </properties>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>model-impl-table-performance-debug</artifactId>
+
+ <name>Cytoscape Model Impl Table Performance Debug
(${project.artifactId})</name>
+
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven-assembly-plugin.version}</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ <archive>
+ <manifest>
+ <mainClass>org.cytoscape.model.PerfTest</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id> <!-- this is used for
inheritance merges -->
+ <phase>package</phase> <!-- append to the packaging
phase. -->
+ <goals>
+ <goal>attached</goal> <!-- goals == mojos -->
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!--
+ This is where any additional implementation dependencies necessary for
+ running the integration tests should reside, NOT in the top level
pom.xml.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>model-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>event-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>model-impl</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+ </dependencies>
+</project>
Added:
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/cytoscape/model/PerfTest.java
===================================================================
---
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/cytoscape/model/PerfTest.java
(rev 0)
+++
core3/impl/trunk/model-impl/table-performance-debug/src/main/java/org/cytoscape/model/PerfTest.java
2012-04-18 22:19:28 UTC (rev 28881)
@@ -0,0 +1,94 @@
+package org.cytoscape.model;
+
+
+
+import org.cytoscape.event.CyEvent;
+import org.cytoscape.event.CyEventHelper;
+import org.cytoscape.event.DummyCyEventHelper;
+import org.cytoscape.equations.Interpreter;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNetworkFactory;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.TableTestSupport;
+import org.cytoscape.service.util.CyServiceRegistrar;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Collection;
+
+
+public class PerfTest {
+
+ private String[] colNames = new String[]
{"a","b","c","d","e","f","g","h","i","j","k","l","m","n"};
+ private Class[] colTypes = new Class[] {String.class, Integer.class,
Long.class, Double.class, Boolean.class};
+ private Object[] colDefaults = new Object[] {"default",
Integer.valueOf(0),Long.valueOf(0), Double.valueOf(0.0), Boolean.FALSE};
+ private final int numRows = 100000;
+ private final Random rand = new Random(numRows);
+ private final int matching = 100;
+
+
+ private final CyTableFactory tableFactory;
+
+ public static void main(String[] args) {
+ new PerfTest().testTableUse();
+ }
+
+ public PerfTest() {
+ TableTestSupport testSupport = new TableTestSupport();
+ tableFactory = testSupport.getTableFactory();
+ }
+
+ private void testTableUse() {
+ CyTable table =
tableFactory.createTable("homer","primaryKey",Integer.class,true,true);
+
+ System.out.println(" create columns");
+ for (int i = 0; i<colNames.length; i++)
+ table.createColumn(colNames[i],
colTypes[i%colTypes.length], false, colDefaults[i%colDefaults.length]);
+
+ System.out.println(" set a bunch of rows");
+ for (int i = 0; i < numRows; i++) {
+ CyRow row = table.getRow(Integer.valueOf(i));
+ for ( int j = 0; j<colNames.length; j++)
+ row.set(colNames[j],
getRandomValue(colTypes[j%colTypes.length]));
+ }
+
+ System.out.println(" get a bunch of rows");
+ for (int i = 0; i < numRows; i++) {
+ CyRow row = table.getRow(Integer.valueOf(i));
+ for ( int j = 0; j<colNames.length; j++)
+ row.get(colNames[j],
colTypes[j%colTypes.length]);
+ }
+
+ System.out.println(" get a bunch of rows in a different way");
+ for ( CyRow row : table.getAllRows() )
+ for ( int j = 0; j<colNames.length; j++)
+ row.get(colNames[j],
colTypes[j%colTypes.length]);
+
+ System.out.println(" get all matching rows ");
+ for ( int j = 0; j<colNames.length; j++)
+ if ( colTypes[j % colTypes.length] == Integer.class )
+ for ( int x = 0; x < matching; x++ )
+
table.getMatchingRows(colNames[j],Integer.valueOf(x));
+ }
+
+ private Object getRandomValue(Class c) {
+ if ( c == Integer.class )
+ return Integer.valueOf( rand.nextInt(matching) );
+ else if ( c == Long.class )
+ return Long.valueOf( rand.nextLong() );
+ else if ( c == Double.class )
+ return Double.valueOf( rand.nextDouble() );
+ else if ( c == Boolean.class )
+ return Boolean.valueOf( rand.nextBoolean() );
+ else if ( c == String.class )
+ return Integer.toString(rand.nextInt());
+ else
+ return null;
+ }
+}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.