101companies / 101worker

4 stars 11 forks source link

Java Fact Extractor #215

Open kevin-klein opened 8 years ago

kevin-klein commented 8 years ago

The Java Fact Extractor has very poor startup time compared to other fact extractors:

kevin@kevin-Aspire-E1-572G:~/101worker/extractors/Java$ time echo 'class Java { }' |  ./extractor 
{
  "package": "",
  "imports": [],
  "fragments": [
    {
      "classifier": "class",
      "name": "Java",
      "fragments": [],
      "annotations": [],
      "startLine": 1,
      "endLine": 1
    }
  ]
}

real    0m0.214s
user    0m0.300s
sys 0m0.020s

Javascript for comparison

kevin@kevin-Aspire-E1-572G:~/101worker/extractors/JavaScript$ time echo 'function x() { console.log("hello") };' |  ./extractor 
[
    {
        "classifier": "function",
        "name": "x",
        "fragments": []
    },
    {
        "type": "EmptyStatement"
    }
]

real    0m0.064s
user    0m0.060s
sys 0m0.004s

The JVM used is openjdk:

kevin@kevin-Aspire-E1-572G:~/101worker/extractors/JavaScript$ java -version
openjdk version "1.8.0_66-internal"
OpenJDK Runtime Environment (build 1.8.0_66-internal-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)

Switching the JVM mode to client did not improve the performance, in fact it made a little worse.