This file contains hidden or 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
// Log timings per task. | |
class TimingsListener : TaskExecutionListener, BuildListener { | |
private var startTime: Long = 0L | |
private val timings = mutableListOf<Pair<Long, String>>() | |
@Override | |
override fun beforeExecute(task: Task) { | |
startTime = System.nanoTime() | |
} |
This file contains hidden or 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
import jdk.incubator.foreign.*; | |
import java.lang.invoke.*; | |
// Original code (C++): https://stackoverflow.com/a/40937610/7659948 | |
public class PanamaJIT { | |
public static final int MEM_COMMIT = 0x00001000; | |
public static final int PAGE_READWRITE = 0x04; | |
public static final int PAGE_EXECUTE_READ = 0x20; |
This file contains hidden or 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
import com.google.common.jimfs.Jimfs; | |
import org.openjdk.jmh.annotations.*; | |
import java.io.BufferedOutputStream; | |
import java.io.BufferedWriter; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.nio.file.FileSystem; | |
import java.nio.file.Files; | |
import java.nio.file.Path; |
This file contains hidden or 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 org.glavo.jmh; | |
import com.google.common.jimfs.Jimfs; | |
import org.openjdk.jmh.annotations.*; | |
import java.io.BufferedOutputStream; | |
import java.io.BufferedWriter; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.nio.charset.Charset; |
This file contains hidden or 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
import java.lang.foreign.*; | |
import java.lang.invoke.*; | |
import java.util.Arrays; | |
import static java.lang.foreign.ValueLayout.*; | |
public class Test { | |
@FunctionalInterface | |
public interface Callback { | |
int invoke(MemorySegment a, MemorySegment b); |
OlderNewer