diff --git a/src/core/executor.py b/src/core/executor.py index 3513120..b791ef1 100644 --- a/src/core/executor.py +++ b/src/core/executor.py @@ -122,13 +122,28 @@ def _run_java(code, tests=None, timeout=None): f.write(code) try: - comp = subprocess.run(["javac", src, "-d", d], capture_output=True, text=True, timeout=max(timeout, 10), cwd=d) + # Added JVM args to javac to speed up its own startup time + comp = subprocess.run([ + "javac", + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + src, "-d", d + ], capture_output=True, text=True, timeout=max(timeout, 10), cwd=d) if comp.returncode: return {"status": "incorrect", "message": "Compilation failed", "compiler_output": comp.stderr} except subprocess.TimeoutExpired: return {"status": "error", "message": "Compilation timed out"} - cmd = ["java", "-cp", d, f"-Xmx{MAX_MEMORY_MB}m", class_name] + # Optimized JVM startup arguments + cmd = [ + "java", + "-cp", d, + f"-Xmx{MAX_MEMORY_MB}m", + "-XX:+TieredCompilation", + "-XX:TieredStopAtLevel=1", + "-noverify", + class_name + ] if tests is None: try: res = subprocess.run(