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
/* | |
* % gcc -O3 -std=c99 -o sum sum.c; ./sum | |
* sum:142913828922,count:148933,cpu:0.00 | |
*/ | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <string.h> |
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
% java -cp target/classes PrimeSum 1000 | |
There are 168 primes <= to 1,000. | |
Their sum is 76,127. | |
Their product is 19,590,340,644,999,083,431,262,508,198,206,381,046,123,972,390,589,368,223,882,605,328,968,666,316,379,870,661,851,951,648,789,482,321,596,229,559,115,436,019,149,189,529,725,215,266,728,292,282,990,852,649,023,362,731,392,404,017,939,142,010,958,261,393,634,959,471,483,757,196,721,672,243,410,067,118,516,227,661,133,135,192,488,848,989,914,892,157,188,308,679,896,875,137,439,519,338,903,968,094,905,549,750,386,407,106,033,836,586,660,683,539,201,011,635,917,900,039,904,495,065,203,299,749,542,985,993,134,669,814,805,318,474,080,581,207,891,125,910. | |
Computed in 0.003sec. |
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
#!/usr/bin/env ruby | |
BLOCK_PATH='/sys/block' | |
MIB = 1024*1024 | |
Dir.entries(BLOCK_PATH).select{|e| e.start_with? 'zram'}.each {|dev| | |
orig = File.read(File.join BLOCK_PATH, dev, 'orig_data_size').to_i | |
compr = File.read(File.join BLOCK_PATH, dev, 'compr_data_size').to_i | |
printf "%s: %6.2f%% (%.2f MiB -> %.2f MiB)\n", dev, 100*compr/orig, orig/MIB, compr/MIB | |
} |
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
Assembly: 0.000169164 * 10000 = 1.691642309 | |
C (diet, static): 0.000178204 * 5000 = 0.891020651 | |
C (musl, static): 0.000194115 * 5000 = 0.970577889 | |
C (musl, dynamic): 0.000342195 * 5000 = 1.710977786 | |
C (static): 0.000090583 * 5000 = 0.452919855 | |
C (dynamic): 0.000702688 * 3000 = 2.108064792 | |
Fortran (static): 0.000455501 * 5000 = 2.277508594 | |
Fortran (dynamic): 0.001639982 * 2000 = 3.279964656 | |
Haskell (static): 0.001355104 * 2000 = 2.710208459 | |
Haskell (dynamic): 0.002697174 * 1000 = 2.697174090 |
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
% <hello.clj; time java -jar /usr/share/clojure/clojure.jar hello.clj; time java -XX:+TieredCompilation -Xbootclasspath/a:/usr/share/clojure/clojure.jar clojure.main hello.clj; time java -jar /usr/share/clojure/clojure.jar hello.clj; time java -XX:+TieredCompilation -Xbootclasspath/a:/usr/share/clojure/clojure.jar clojure.main hello.clj | |
(println "hello world") | |
hello world | |
java -jar /usr/share/clojure/clojure.jar hello.clj 1.17s user 0.22s system 134% cpu 1.038 total | |
hello world | |
java -XX:+TieredCompilation -Xbootclasspath/a:/usr/share/clojure/clojure.jar 0.72s user 0.03s system 178% cpu 0.420 total | |
hello world | |
java -jar /usr/share/clojure/clojure.jar hello.clj 1.14s user 0.21s system 132% cpu 1.012 total | |
hello world | |
java -XX:+TieredCompilation -Xbootclasspath/a:/usr/share/clojure/clojure.jar 0.68s user 0.04s system 180% cpu 0.395 total |
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
0.000000 execve("./noop_go", ["./noop_go"], [/* 66 vars */]) = 0 | |
0.000945 arch_prctl(ARCH_SET_FS, 0x427428) = 0 | |
0.000254 open("/proc/stat", O_RDONLY|O_CLOEXEC) = 3 | |
0.000340 read(3, "cpu 10578637 859618 3023222 179"..., 252) = 252 | |
0.000247 read(3, "522313 45769723 42392 0 747 0 0 "..., 252) = 252 | |
0.000161 read(3, " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"..., 252) = 252 | |
0.000138 read(3, " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"..., 252) = 252 | |
0.000117 read(3, " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"..., 252) = 252 | |
0.000115 read(3, " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"..., 252) = 252 | |
0.000153 read(3, " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"..., 252) = 252 |
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
$ CC=clang ./configure; make 2>&1 | head -n100 | |
checking for C compiler... clang | |
checking whether compiler is gcc... no | |
checking target system type... x86_64-unknown-linux-gnu | |
checking whether compiler accepts -std=c99... yes | |
checking whether compiler accepts -nostdinc... yes | |
checking whether compiler accepts -ffreestanding... yes | |
checking whether compiler accepts -fexcess-precision=standard... yes | |
checking whether compiler accepts -frounding-math... yes | |
checking whether compiler accepts -Os... yes |
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
% ls -lh ./build/darwin-x86_64*/avian | |
5473595 -rwxr-xr-x 1 pierre staff 67M Nov 13 00:39 ./build/darwin-x86_64-openjdk-src/avian* | |
4876755 -rwxr-xr-x 1 pierre staff 1.2M Nov 11 06:01 ./build/darwin-x86_64/avian* | |
% for j in build/darwin-x86_64*/avian java; time $j -cp $HOME Hello | |
Hello | |
$j -cp $HOME Hello 0.10s user 0.01s system 96% cpu 0.122 total | |
Hello | |
$j -cp $HOME Hello 0.01s user 0.00s system 87% cpu 0.008 total | |
Hello | |
$j -cp $HOME Hello 0.09s user 0.02s system 100% cpu 0.109 total |
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
Trying to be "idiomatic" yet fair. Used JD GUI to show the bytecode in human-readable Java. | |
Somehow mirah breaks JD GUI, which is probably interesting. | |
So I went through an intermediate Java file thanks to mirah -j instead. |
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
Q: Does this Linux ISO support booting off a USB pendrive on a Mac EFI? | |
(I don't want no BIOS jail, that shit drove me insane about 8 hours ago and I'm out of coffee now) | |
A: Simple! Yes if it starts with ER. No if it doesn't start with ER. | |
Examples: | |
% (dd bs=8 count=1 2>/dev/null|xxd) < Fedora-17-x86_64-Live-Desktop.iso | |
0000000: 4552 0800 0000 9090 ER...... | |
===> That's a yes. |