Created
September 26, 2016 12:33
-
-
Save olegchir/140b4507a2d9c4a129365895e5538c43 to your computer and use it in GitHub Desktop.
PHP vs Java - Hello World average time - #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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