Skip to content

Instantly share code, notes, and snippets.

View ted-wq-x's full-sized avatar
🎯
Focusing

Luffy ted-wq-x

🎯
Focusing
View GitHub Profile
@ted-wq-x
ted-wq-x / .sh
Created July 26, 2018 06:12
常用shell
#!/usr/bin/env bash
CMD=java
JAVA_VER=$(java -version 2>&1 | grep -i version | sed 's/.*version ".*\.\(.*\)\..*"/\1/; 1q')
if [ ${JAVA_VER} -lt 8 ]; then
echo "JDK版本过低,请使用1.8及以上版本"
exit 1
fi
public class CacheLineEffect {
//考虑一般缓存行大小是64字节,一个 long 类型占8字节
static long[][] arr;
public static void main(String[] args) {
arr = new long[1024 * 1024][];
for (int i = 0; i < 1024 * 1024; i++) {
arr[i] = new long[8];
for (int j = 0; j < 8; j++) {
arr[i][j] = 0L;