Index: trunk/test/performance/org/openstreetmap/josm/data/osm/MapPaintVisitorPerformanceTest.java
===================================================================
--- trunk/test/performance/org/openstreetmap/josm/data/osm/MapPaintVisitorPerformanceTest.java	(revision 7033)
+++ 	(revision )
@@ -1,112 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.data.osm;
-
-import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.Bounds;
-import org.openstreetmap.josm.data.osm.visitor.paint.Rendering;
-import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
-import org.openstreetmap.josm.data.projection.Projections;
-import org.openstreetmap.josm.gui.NavigatableComponent;
-import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
-import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
-import org.openstreetmap.josm.io.OsmReader;
-
-public class MapPaintVisitorPerformanceTest {
-
-    private static final int IMG_WIDTH = 1400;
-    private static final int IMG_HEIGHT = 1050;
-
-    private static Graphics2D g;
-    private static BufferedImage img;
-    private static NavigatableComponent nc;
-    private static DataSet dsRestriction;
-    private static DataSet dsMultipolygon;
-    private static DataSet dsCity;
-
-    @BeforeClass
-    public static void load() throws Exception {
-        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_3BYTE_BGR);
-        g = (Graphics2D)img.getGraphics();
-        nc = new NavigatableComponent();
-        nc.setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT);
-
-        // TODO Test should have it's own copy of styles because change in style can influence performance
-        Main.pref.load();
-        MapPaintStyles.readFromPreferences();
-
-        try (
-            InputStream fisR = new FileInputStream("data_nodist/restriction.osm");
-            InputStream fisM = new FileInputStream("data_nodist/multipolygon.osm");
-            InputStream fisC = new FileInputStream("data_nodist/neubrandenburg.osm");
-        ) {
-            dsRestriction = OsmReader.parseDataSet(fisR, NullProgressMonitor.INSTANCE);
-            dsMultipolygon = OsmReader.parseDataSet(fisM, NullProgressMonitor.INSTANCE);
-            dsCity = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE);
-        }
-
-        // Warm up
-        new MapPaintVisitorPerformanceTest().testRestrictionSmall();
-        new MapPaintVisitorPerformanceTest().testCity();
-    }
-
-    private static void test(int iterations, DataSet ds, Bounds bounds) throws Exception {
-        Rendering visitor = new StyledMapRenderer(g,nc,false);
-        nc.zoomTo(bounds);
-        for (int i=0; i<iterations; i++) {
-            visitor.render(ds, true, bounds);
-        }
-    }
-
-    @Test
-    public void testRestriction() throws Exception {
-        test(700, dsRestriction, new Bounds(51.12, 14.147472381591795, 51.128, 14.162492752075195));
-    }
-
-    @Test
-    public void testRestrictionSmall() throws Exception {
-        test(1500, dsRestriction, new Bounds(51.125, 14.147, 51.128, 14.152));
-    }
-
-    @Test
-    public void testMultipolygon() throws Exception {
-        test(400, dsMultipolygon, new Bounds(60, -180, 85, -122));
-    }
-
-    @Test
-    public void testMultipolygonSmall() throws Exception {
-        test(850, dsMultipolygon, new Bounds(-90, -180, 90, 180));
-    }
-
-    @Test
-    public void testCity() throws Exception {
-        test(50, dsCity, new Bounds(53.51, 13.20, 53.59, 13.34));
-    }
-
-    @Test
-    public void testCitySmall() throws Exception {
-        test(70, dsCity, new Bounds(52, 11, 55, 14));
-    }
-
-    @Test
-    public void testCityPart1() throws Exception {
-        test(250, dsCity, new Bounds(53.56, 13.25, 53.57, 13.26));
-    }
-
-    @Test
-    public void testCityPart2() throws Exception {
-        test(200, dsCity, new Bounds(53.55, 13.29, 53.57, 13.30));
-    }
-
-    @Test
-    public void testCitySmallPart2() throws Exception {
-        test(200, dsCity, new Bounds(53.56, 13.295, 53.57, 13.30));
-    }
-}
Index: trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java
===================================================================
--- trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java	(revision 7033)
+++ trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java	(revision 7068)
@@ -1,3 +1,6 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.data.osm;
+
+import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
@@ -5,8 +8,6 @@
 import org.openstreetmap.josm.data.coor.LatLonTest;
 
-import static org.junit.Assert.assertTrue;
+public class RoundingPerformanceTest {
 
-public class RoundingPerformanceTest extends LatLonTest {
-    
     private static double oldRoundToOsmPrecision(double value) {
         return Math.round(value / LatLon.MAX_SERVER_PRECISION) * LatLon.MAX_SERVER_PRECISION; // Old method, causes rounding errors, but efficient
@@ -18,5 +19,5 @@
         long start = System.nanoTime();
         for (int i = 0; i < n; i++) {
-            for (double value : sampleValues) {
+            for (double value : LatLonTest.SAMPLE_VALUES) {
                 oldRoundToOsmPrecision(value);
             }
@@ -25,8 +26,8 @@
         long oldTime = end-start;
         System.out.println("Old time: "+oldTime/1000000.0 + " ms");
-        
+
         start = System.nanoTime();
         for (int i = 0; i < n; i++) {
-            for (double value : sampleValues) {
+            for (double value : LatLonTest.SAMPLE_VALUES) {
                 LatLon.roundToOsmPrecision(value);
             }
@@ -35,5 +36,5 @@
         long newTime = end-start;
         System.out.println("New time: "+newTime/1000000.0 + " ms");
-        
+
         assertTrue(newTime <= oldTime*10);
     }
Index: trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java
===================================================================
--- trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java	(revision 7068)
+++ trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java	(revision 7068)
@@ -0,0 +1,113 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.osm.visitor.paint;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.visitor.paint.Rendering;
+import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
+import org.openstreetmap.josm.data.projection.Projections;
+import org.openstreetmap.josm.gui.NavigatableComponent;
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
+import org.openstreetmap.josm.io.OsmReader;
+
+public class StyledMapRendererPerformanceTest {
+
+    private static final int IMG_WIDTH = 1400;
+    private static final int IMG_HEIGHT = 1050;
+
+    private static Graphics2D g;
+    private static BufferedImage img;
+    private static NavigatableComponent nc;
+    private static DataSet dsRestriction;
+    private static DataSet dsMultipolygon;
+    private static DataSet dsCity;
+
+    @BeforeClass
+    public static void load() throws Exception {
+        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
+        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_3BYTE_BGR);
+        g = (Graphics2D)img.getGraphics();
+        nc = new NavigatableComponent();
+        nc.setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT);
+
+        // TODO Test should have it's own copy of styles because change in style can influence performance
+        Main.pref.load();
+        MapPaintStyles.readFromPreferences();
+
+        try (
+            InputStream fisR = new FileInputStream("data_nodist/restriction.osm");
+            InputStream fisM = new FileInputStream("data_nodist/multipolygon.osm");
+            InputStream fisC = new FileInputStream("data_nodist/neubrandenburg.osm");
+        ) {
+            dsRestriction = OsmReader.parseDataSet(fisR, NullProgressMonitor.INSTANCE);
+            dsMultipolygon = OsmReader.parseDataSet(fisM, NullProgressMonitor.INSTANCE);
+            dsCity = OsmReader.parseDataSet(fisC, NullProgressMonitor.INSTANCE);
+        }
+
+        // Warm up
+        new StyledMapRendererPerformanceTest().testRestrictionSmall();
+        new StyledMapRendererPerformanceTest().testCity();
+    }
+
+    private static void test(int iterations, DataSet ds, Bounds bounds) throws Exception {
+        Rendering visitor = new StyledMapRenderer(g,nc,false);
+        nc.zoomTo(bounds);
+        for (int i=0; i<iterations; i++) {
+            visitor.render(ds, true, bounds);
+        }
+    }
+
+    @Test
+    public void testRestriction() throws Exception {
+        test(700, dsRestriction, new Bounds(51.12, 14.147472381591795, 51.128, 14.162492752075195));
+    }
+
+    @Test
+    public void testRestrictionSmall() throws Exception {
+        test(1500, dsRestriction, new Bounds(51.125, 14.147, 51.128, 14.152));
+    }
+
+    @Test
+    public void testMultipolygon() throws Exception {
+        test(400, dsMultipolygon, new Bounds(60, -180, 85, -122));
+    }
+
+    @Test
+    public void testMultipolygonSmall() throws Exception {
+        test(850, dsMultipolygon, new Bounds(-90, -180, 90, 180));
+    }
+
+    @Test
+    public void testCity() throws Exception {
+        test(50, dsCity, new Bounds(53.51, 13.20, 53.59, 13.34));
+    }
+
+    @Test
+    public void testCitySmall() throws Exception {
+        test(70, dsCity, new Bounds(52, 11, 55, 14));
+    }
+
+    @Test
+    public void testCityPart1() throws Exception {
+        test(250, dsCity, new Bounds(53.56, 13.25, 53.57, 13.26));
+    }
+
+    @Test
+    public void testCityPart2() throws Exception {
+        test(200, dsCity, new Bounds(53.55, 13.29, 53.57, 13.30));
+    }
+
+    @Test
+    public void testCitySmallPart2() throws Exception {
+        test(200, dsCity, new Bounds(53.56, 13.295, 53.57, 13.30));
+    }
+}
Index: trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy
===================================================================
--- trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy	(revision 7068)
+++ trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.groovy	(revision 7068)
@@ -0,0 +1,128 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.mappaint.mapcss;
+
+import static org.junit.Assert.*
+
+import java.awt.Graphics2D
+import java.awt.image.BufferedImage
+
+import org.junit.*
+import org.openstreetmap.josm.Main
+import org.openstreetmap.josm.data.Bounds
+import org.openstreetmap.josm.data.osm.DataSet
+import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer
+import org.openstreetmap.josm.gui.MainApplication
+import org.openstreetmap.josm.gui.layer.OsmDataLayer
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles
+import org.openstreetmap.josm.gui.preferences.SourceEntry
+import org.openstreetmap.josm.io.OsmReader
+
+/**
+ * This performance test measures the time for a full run of MapPaintVisitor.visitAll()
+ * against a test data set using a test style.
+ *
+ */
+class MapCSSPerformanceTest {
+
+    /* ------------------------ configuration section  ---------------------------- */
+    /**
+     * The path to the JOSM home environment
+     */
+    def static JOSM_HOME="test/config/performance-josm.home"
+
+    /**
+     * The path to the style file used for rendering.
+     */
+    def static STYLE_FILE="styles/standard/elemstyles.mapcss"
+
+    /**
+     * The data file to be rendered
+     */
+    def static DATA_FILE = "/my/test-data.osm"
+    /* ------------------------ / configuration section  ---------------------------- */
+
+    def DataSet ds
+
+    def static boolean checkTestEnvironment() {
+          File f = new File(JOSM_HOME)
+          if  (!f.isDirectory() || !f.exists()) {
+              fail("JOSM_HOME refers to '${JOSM_HOME}. This is either not a directory or doesn't exist.\nPlease update configuration settings in the unit test file.")
+          }
+
+          f = new File(STYLE_FILE);
+          if ( !f.isFile() || ! f.exists()) {
+              fail("STYLE_FILE refers to '${STYLE_FILE}. This is either not a file or doesn't exist.\nPlease update configuration settings in the unit test file.")
+          }
+
+          f = new File(DATA_FILE);
+          if ( !f.isFile() || ! f.exists()) {
+              fail("DATA_FILE refers to '${DATA_FILE}. This is either not a file or doesn't exist.\nPlease update configuration settings in the unit test file.")
+          }
+    }
+
+    @BeforeClass
+    public static void createJOSMFixture(){
+        checkTestEnvironment()
+        System.setProperty("josm.home", JOSM_HOME)
+        MainApplication.main(new String[0])
+    }
+
+    def timed(Closure c){
+        long before = System.currentTimeMillis()
+        c()
+        long after = System.currentTimeMillis()
+        return after - before
+    }
+
+    def  loadStyle() {
+        print "Loading style '$STYLE_FILE' ..."
+        MapCSSStyleSource source = new MapCSSStyleSource(
+            new SourceEntry(
+                new File(STYLE_FILE).toURI().toURL().toString(),
+                "test style",
+                "a test style",
+                true // active
+            )
+        )
+        source.loadStyleSource()
+        if (!source.errors.isEmpty()) {
+            fail("Failed to load style file ''${STYLE_FILE}''. Errors: ${source.errors}")
+        }
+        MapPaintStyles.getStyles().clear()
+        MapPaintStyles.getStyles().add(source)
+        println "DONE"
+    }
+
+    def loadData() {
+        print "Loading data file '$DATA_FILE' ..."
+        new File(DATA_FILE).withInputStream {
+            InputStream is ->
+            ds = OsmReader.parseDataSet(is,null)
+        }
+        Main.main.addLayer(new OsmDataLayer(ds,"test layer",null /* no file */));
+        println "DONE"
+    }
+
+    @Test
+    public void measureTimeForStylePreparation() {
+        loadStyle()
+        loadData()
+
+        def mv = Main.map.mapView
+
+        BufferedImage img = mv.createImage(mv.getWidth(), mv.getHeight())
+        Graphics2D g = img.createGraphics()
+        g.setClip(0,0, mv.getWidth(), mv.getHeight())
+        def visitor = new StyledMapRenderer(g, Main.map.mapView, false)
+
+        print "Rendering ..."
+        long time = timed {
+            visitor.render(ds, false, new Bounds(-90,-180,90,180))
+        }
+        println "DONE"
+        println "data file : ${DATA_FILE}"
+        println "style file: ${STYLE_FILE}"
+        println ""
+        println "Rendering took $time ms."
+    }
+}
