Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1688

Dynamic compilation excessive typed instance variables resolution as class lookup

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-6, 1.0-RC-1, 1.0-RC-2, 1.0
    • 1.1-beta-2
    • class generator
    • None
    • Linux 2.4.29

    Description

      Here is a simple example with an attached http log trace.

      I put 2 files on a web server. Not groovyc, just POGO

      Book.groovy
      class Book {
      String title
      Author author
      }

      Author.groovy
      class Author {
      String firstname
      String lastname
      }

      I then created a simple Java file that uses GCL

      import groovy.lang.GroovyClassLoader;
      import java.net.URL;

      public class TestRemote {
      public static void main(String[] args) throws Throwable

      { GroovyClassLoader gcl = new GroovyClassLoader (); gcl.addURL (new URL ("http://crsvpn.newgenesys.com/www/crs-test/")); gcl.loadClass ("Book"); }

      }

      And got that trace

      192.168.202.4 - - [25/Jan/2007:06:13:22 -0800] "GET /www/crs-test/Book.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:22 -0800] "HEAD /www/crs-test/Book.groovy HTTP/1.1" 200 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:22 -0800] "GET /www/crs-test/Book.groovy HTTP/1.1" 200 46 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/lang/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/io/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/net/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/util/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/groovy/lang/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/groovy/lang/Author.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/groovy/util/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/groovy/util/Author.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/Author.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/Author.groovy HTTP/1.1" 200 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/Author.groovy HTTP/1.1" 200 104 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/lang/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/io/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/net/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/util/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/groovy/lang/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/groovy/lang/firstname.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/groovy/util/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/groovy/util/firstname.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/firstname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/firstname.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/lang/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/io/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/net/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/java/util/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/groovy/lang/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/groovy/lang/lastname.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/groovy/util/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/groovy/util/lastname.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "GET /www/crs-test/lastname.class HTTP/1.1" 404 1072 "-" "Java/1.5.0_08"
      192.168.202.4 - - [25/Jan/2007:06:13:24 -0800] "HEAD /www/crs-test/lastname.groovy HTTP/1.1" 404 - "-" "Java/1.5.0_08"

      I would have expected to only have lookups for the 2 class names, Author and Book. While this is extreme, it is possible
      that the problem exists too with file:/ and could be a huge speed boost for dynamic Groovy

      Note: If I compile the Book.groovy, I only get 1 lookup for Book.class.

      Hope that helps

      Pascal

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              pdemilly Pascal Demilly
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: