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
#include <stdio.h> | |
#include <time.h> | |
typedef unsigned int uint32; | |
typedef long long int64; | |
template<typename F, typename V> | |
V collision_point(const F& f, V x) { | |
V slow = x; | |
V fast = f(x); |
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
// setup | |
int status = 0; | |
do { | |
// preconditions | |
status = doSomething(); | |
if (status) break; | |
status = doSomethingElse(); | |
if (status) break; |
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
PAYLOAD_TEMPLATE = \ | |
"""--==boundary\r | |
Content-Disposition: form-data; name="file"; filename="%s"\r | |
Content-Type: %s\r | |
\r | |
%s\r | |
--==boundary--\r | |
""" | |
destination_url = blobstore.create_upload_url('/upload-sink') |
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
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 4x mutex op, 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns 3 µs | |
Send 2K bytes over 1 Gbps network 20,000 ns 20 µs | |
Read 1 MB sequentially from memory 250,000 ns 250 µs | |
Round trip within same datacenter 500,000 ns 0.5 ms | |
Disk seek 10,000,000 ns 10 ms |
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
; Function Attrs: nounwind readonly uwtable | |
define double @_Z10DotProductRK6VectorS1_(%class.Vector* nocapture %v1, %class.Vector* nocapture %v2) #0 { | |
entry: | |
%size_.i = getelementptr inbounds %class.Vector* %v1, i64 0, i32 0 | |
%0 = load i64* %size_.i, align 8, !tbaa !0 | |
%data_.i = getelementptr inbounds %class.Vector* %v1, i64 0, i32 1 | |
%1 = load double** %data_.i, align 8, !tbaa !3 | |
%size_.i8 = getelementptr inbounds %class.Vector* %v2, i64 0, i32 0 | |
%2 = load i64* %size_.i8, align 8, !tbaa !0 | |
%data_.i9 = getelementptr inbounds %class.Vector* %v2, i64 0, i32 1 |
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
class Printer[T](_t: T) { | |
def t = _t | |
def print():Unit = { println(t) } | |
} | |
class IterablePrinter[T, I <: Iterable[T]](p : Printer[I]) { | |
def printEach() = p.t.foreach(println) | |
} | |
object Test extends App { |
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
public class HeadTest { | |
public static void main(String[] args) { | |
Observable<Integer> fileReader = Observable.create((Observable.OnSubscribe<Integer>) subscriber -> { | |
System.out.println("Reading from a file"); | |
subscriber.onNext(100); // header | |
for (int i = 0; i < 10; ++i) { | |
subscriber.onNext(i); | |
} |
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
public class HeadTest { | |
public static void main(String[] args) { | |
Observable<Integer> fileReader = Observable.create((Observable.OnSubscribe<Integer>) subscriber -> { | |
System.out.println("Reading from a file"); | |
subscriber.onNext(100); // header | |
for (int i = 0; i < 10; ++i) { | |
subscriber.onNext(i); | |
} |
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
public class Test { | |
private static void foo(String value, int...ints) { | |
System.out.println(value + " " + Arrays.asList(ints)); | |
} | |
private static void bar(String value, int...ints) { | |
foo(value, ints); | |
} | |
private static void baz(String value) { |
OlderNewer