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
| /*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ | |
| │vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi│ | |
| ╞══════════════════════════════════════════════════════════════════════════════╡ | |
| │ Copyright 2022 Justine Alexandra Roberts Tunney │ | |
| │ │ | |
| │ Permission to use, copy, modify, and/or distribute this software for │ | |
| │ any purpose with or without fee is hereby granted, provided that the │ | |
| │ above copyright notice and this permission notice appear in all copies. │ | |
| │ │ | |
| │ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ |
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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |