groovy

Dynamic compilation excessive typed instance variables resolution as class lookup

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-JSR-6, 1.0-RC-1, 1.0-RC-2, 1.0
  • Fix Version/s: 1.1-beta-2
  • Component/s: class generator
  • Labels:
    None
  • Environment:
    Linux 2.4.29
  • Number of attachments :
    0

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

Issue Links

Activity

Hide
blackdrag blackdrag added a comment -

I have really a problem in reproducing this... I mean my log looks (short form) like this:

GET /other/Book.class
HEAD /other/Book.groovy
GET /other/Book.groovy
GET /other/java/lang/Author.class
GET /other/java/io/Author.class
GET /other/java/net/Author.class
GET /other/java/util/Author.class
GET /other/groovy/lang/Author.class
HEAD /other/groovy/lang/Author.groovy
GET /other/groovy/util/Author.class
HEAD /other/groovy/util/Author.groovy
GET /other/Author.class
HEAD /other/Author.groovy
GET /other/Author.groovy

Note:

  • the files where stored in /other/
  • the url was http://127.0.0.1:8080/other/
  • webserver was jetty with a handler I wrote, that pesponds to the HEAD request and writes the output above, additonally a ResourceHandler and the Default Handler (in this order)

Are you sure your Author and Book files do contain only of what you mentioned here?

Show
blackdrag blackdrag added a comment - I have really a problem in reproducing this... I mean my log looks (short form) like this: GET /other/Book.class HEAD /other/Book.groovy GET /other/Book.groovy GET /other/java/lang/Author.class GET /other/java/io/Author.class GET /other/java/net/Author.class GET /other/java/util/Author.class GET /other/groovy/lang/Author.class HEAD /other/groovy/lang/Author.groovy GET /other/groovy/util/Author.class HEAD /other/groovy/util/Author.groovy GET /other/Author.class HEAD /other/Author.groovy GET /other/Author.groovy Note:
  • the files where stored in /other/
  • the url was http://127.0.0.1:8080/other/
  • webserver was jetty with a handler I wrote, that pesponds to the HEAD request and writes the output above, additonally a ResourceHandler and the Default Handler (in this order)
Are you sure your Author and Book files do contain only of what you mentioned here?
Hide
blackdrag blackdrag added a comment -

the newest version should not have this problem anymore

Show
blackdrag blackdrag added a comment - the newest version should not have this problem anymore

People

Vote (2)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: