Skip to content

Instantly share code, notes, and snippets.

@olegchir
Created September 26, 2016 12:33
Show Gist options
  • Save olegchir/140b4507a2d9c4a129365895e5538c43 to your computer and use it in GitHub Desktop.
Save olegchir/140b4507a2d9c4a129365895e5538c43 to your computer and use it in GitHub Desktop.
PHP vs Java - Hello World average time - #1
package com.olegchir.trollcaster.test1;
import org.openjdk.jmh.annotations.*;
import java.io.File;
import java.io.IOException;
public class PHPvsJavaBenchmark1 {
private static final String PHP_HOME = "C:\\Users\\olegchir\\Downloads\\php-7.0.11-nts-Win32-VC14-x86";
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@Measurement(iterations = 3)
@Warmup(iterations = 3)
public void java() {
System.out.println("Hello World!");
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@Measurement(iterations = 3)
@Warmup(iterations = 3)
public void php() throws IOException {
Runtime.getRuntime().exec(PHP_HOME + File.separator + "php -r \"echo \"Hello World\"\";");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment