This file contains 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 | |
-------------------------- | |
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 | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
This file contains 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
/* | |
Basic idea is to create an inspector for exploring state of a D program from a console using Lua | |
to view and perhaps modify D state. You can then call this inspector either like a breakpoint by | |
just placing a call to it where you wish your code to stop, or implement something fancier so that | |
you can interrupt the code live from the debugging console or specify conditions that will lead to | |
a 'breakpoint'. (Perhaps annotate the functions that need to check if they need to call in to the | |
debugger, and conceivably have some kind of interprocess communication). | |
Also means you can log to a data structure rather than text file, and inspect the data structure in | |
a more precise and structured way via Lua |
This file contains 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
pure: | |
nothrow: | |
// T[] = T[] op T[] | |
void arrayOp(string op, T)(T[] res, in T[] a, in T[] b) | |
in | |
{ | |
assert(res.length == a.length); | |
assert(res.length == b.length); | |
} |
This file contains 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 gzip | |
import json | |
import requests | |
try: | |
from cStringIO import StringIO | |
except: | |
from StringIO import StringIO | |
# Let's fetch the Common Crawl FAQ using the CC index | |
resp = requests.get('http://index.commoncrawl.org/CC-MAIN-2015-27-index?url=http%3A%2F%2Fcommoncrawl.org%2Ffaqs%2F&output=json') |
This file contains 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
module doveadm; | |
import std.stdio; | |
import std.socket; | |
import std.string; | |
import std.array; | |
import std.c.linux.socket; | |
import core.sys.posix.sys.un; | |
import std.conv; | |
enum doveadmSocketPath= "/var/run/dovecot/doveadm-server"; |
This file contains 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
hid_t createDataType(T)(T datatype) | |
{ | |
auto tid=H5T.create(H5TClass.Compound,datatype.sizeof); | |
enum offsetof(alias type, string field) = mixin(type.stringof ~"."~field~".offsetof"); | |
foreach(member; __traits(derivedMembers, T)) | |
{ | |
// debug(5) writefln("member: %s: offset=%s",member,offsetof!(T,member)); | |
H5T.insert(tid, member, offsetof!(T,member), mapDtoHDF5Type(typeof(__traits(getMember,T,member)).stringof)); | |
} |
This file contains 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 hdf5.wrap; | |
import hdf5.bindings.enums; | |
import std.stdio; | |
import std.file; | |
void main(string[] args) | |
{ | |
if (args.length!=2) | |
{ |
This file contains 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
module deneme; | |
import std.string; | |
import std.traits; | |
struct MyAttr | |
{} | |
@MyAttr | |
void foo(int i, double d) pure @nogc nothrow @property |
This file contains 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 std.array; | |
import std.string; | |
import std.stdio; | |
import std.range; | |
uint endsWithAny(alias pred = "a == b", Range, Needles)(Range haystack, Needles needles) | |
if (isBidirectionalRange!Range && isInputRange!Needles && | |
is(typeof(.endsWith!pred(haystack, needles.front)) : bool)) | |
{ | |
foreach (i, e; needles) |
This file contains 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
module gitrmcache; | |
import std.stdio; | |
import std.file; | |
import std.process; | |
int main(string[] args) | |
{ | |
if (!((args.length==2) || (args.length==3))) | |
{ | |
writefln("syntax is gitrmcache <path> [filespec]"); |
NewerOlder