Issue Details (XML | Word | Printable)

Key: GROOVY-1688
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Pascal Demilly
Votes: 2
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
groovy

Dynamic compilation excessive typed instance variables resolution as class lookup

Created: 31/Jan/07 03:10 PM   Updated: 01/Jul/07 05:39 PM
Component/s: class generator
Affects Version/s: 1.0-JSR-6, 1.0-RC-1, 1.0-RC-2, 1.0
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

Environment: Linux 2.4.29
Issue Links:
Related
 


 Description  « Hide
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



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou added a comment - 23/May/07 01:20 PM
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?


Jochen Theodorou added a comment - 01/Jul/07 05:39 PM
the newest version should not have this problem anymore