Skip to content

Instantly share code, notes, and snippets.

View bgamari's full-sized avatar

Ben Gamari bgamari

View GitHub Profile
ulimit -n 32000
_build/stage1/bin/ghc -O -threaded -rtsopts EchoServer.hs -debug
./EchoServer +RTS -N4 -s -DS -RTS &
echo 'GET http://localhost:3000/' | nix run nixpkgs.vegeta -c vegeta attack -rate 4000 -body Vagrantfile >out
kill %1
nix run nixpkgs.vegeta -c vegeta report < out
@bgamari
bgamari / default.nix
Last active May 27, 2020 15:04
haskell-nix configuration for cross-compiling Hadolint
let
haskellNixSrc = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/a823ba4b7126d11ca272ef70b842b0ea5523fcfd.tar.gz;
haskellNix = import haskellNixSrc {};
nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
nixpkgsArgs = haskellNix.nixpkgsArgs;
in
{ pkgs ? (import nixpkgsSrc nixpkgsArgs).pkgsCross.aarch64-multiplatform-musl
}:
let
hspkgs = pkgs.haskell-nix.stackProject {
diff --git a/runstdtest/runstdtest.prl b/runstdtest/runstdtest.prl
index 4ac632f..fb12099 100644
--- a/runstdtest/runstdtest.prl
+++ b/runstdtest/runstdtest.prl
@@ -209,7 +209,7 @@ if ($PostScript ne '') {
# OK, so we're gonna do the normal thing...
if ($Cachegrind eq 'yes') {
- $CachegrindPrefix = "valgrind --tool=cachegrind --log-fd=9 9>$CachegrindStats";
+ $CachegrindPrefix = "valgrind --tool=cachegrind --dsymutil=no --log-fd=9 9>$CachegrindStats";
#include <stdint.h>
#include <fenv.h>
float hs_word2float32_old(uint64_t x) {
return (float)x;
}
float hs_word2float32_new(uint64_t x) {
int r = fegetround();
fesetround(FE_TOWARDZERO);
@bgamari
bgamari / demangle-ghc.c
Last active December 28, 2019 02:41
Demangler for GHC's Z encoding
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/*
* See https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/symbol-names
*/
/*
* Returns number of characters decoded including NULL-terminator or zero if
@bgamari
bgamari / ghc-timings
Last active September 6, 2019 11:43
GHC Timings
CPU time, elapsed
Productivity Mutator GC
CPU elapsed CPU elapsed
------------- ----- -------- ----- --------
-j1 -A1M 83% 33.5 43.9 6.8 6.8
-j4 -A1M 56% 48.4 24.4 38.8 10.9
-j4 -A16M 60% 49.3 25.0 33.2 9.3
-j4 -A64M 80% 49.7 25.4 11.9 3.5
-j4 -A16M -qn2 77% 49.0 24.6 14.7 7.5
@bgamari
bgamari / bfd
Created July 26, 2019 19:31
linker timings
0.63 4.02
0.64 3.98
0.62 3.93
0.57 3.94
0.63 3.90
0.58 3.88
0.62 3.87
0.68 4.09
0.62 4.09
0.61 4.09
title
Rich errors messages in GHC

Pretty-printer with point annotations

See the proposal.

Pros

data StackField b = PointerField b
| WordField !Word
data StackFrame b = StackFrame { infoTable :: StgInfoTable
, fields :: [StackField b]
}
data GenClosure b = ...
| StackClosure [StackFrame b]