Skip to content

Instantly share code, notes, and snippets.

View Geod24's full-sized avatar

Mathias LANG Geod24

View GitHub Profile
@Geod24
Geod24 / exceptions_benchmark.d
Created May 3, 2020 19:31
Benchmarking D's exception implementation
/// Context: I am currently working on improving debug info formatting in druntime
/// There are a few obvious things which are **very** wrong and performances seem abysmal.
/// The following is the first benchmark code I came up with:
import std.stdio;
void main ()
{
try
{
foo();
@Geod24
Geod24 / nrvo_struct_ctor.d
Last active March 19, 2020 09:36
Test that NRVO is performed on structs when using metaprogramming
import std.traits;
import std.typecons;
import std.meta;
struct Foo1
{
@disable this(this);
@disable ref Foo1 opAssign () (auto ref Foo1 other);
void* ptr;
@Geod24
Geod24 / mytest.d
Created November 4, 2015 23:27
Having fun with Ruby
// Compiled with:
// ./dmd2/linux/bin64/dmd -L-rpath=`pwd`/dmd2/linux/lib64/ -L-L`pwd`/dmd2/linux/lib64/ -defaultlib=libphobos2.so -fPIC -shared -ofmytest.so src/mytest.d
// Run with: irb -r ./mytest.so
module mytest;
// Everything in Ruby is a value, which is a pointer under the hood,
// but is used as numeric value. IDK what's better here: void* or ulong
alias ulong VALUE;
// This is a bit tricky: Some methods takes function pointers which are