Skip to content

Instantly share code, notes, and snippets.

View ndmitchell's full-sized avatar

Neil Mitchell ndmitchell

View GitHub Profile
[1 of 1] Compiling Main ( Test.hs, Test.o )
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 91, types: 143, coercions: 20, joins: 0/2}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
Main.$trModule4 :: GHC.Prim.Addr#
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
setValues state key file val = modifyVar_ state $ \vals -> do
-- Force to make sure the old HashMap is not retained
evaluate val
let v = fmap toDyn val
_ <- evaluate v
let k = (file, Key key)
weak <- case HMap.lookup k vals of
Nothing -> pure Nothing
Just v -> do
@ndmitchell
ndmitchell / Benchmark.hs
Last active May 25, 2020 15:44
Ghcide benchmark
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE PatternSynonyms #-}
module Benchmark(main) where
import Control.Applicative.Combinators
@ndmitchell
ndmitchell / main.rs
Created April 28, 2020 20:47
Various forms of interpreter
#![feature(box_syntax)]
use std::time::Instant;
enum Expr {
Lit(i64),
Var(usize),
Add(Box<Expr>, Box<Expr>),
Assign(usize, Box<Expr>),
Then(Box<Expr>, Box<Expr>),
System.Process
1.23s 1.19s 1.22s 1.18s 1.23s = 1.21s
shake.cmd
1.23s 1.22s 1.21s 1.22s 1.24s = 1.22s
shake.cmd fsatrace
1.27s 1.24s 1.25s 1.22s 1.34s = 1.26s
shake.cmd traced
1.33s 1.28s 1.27s 1.24s 1.26s = 1.27s
rattle
cc -g -std=c99 -Wall -O2 -fomit-frame-pointer -fno-stack-protector -D_GNU_SOURCE -D_DEFAULT_SOURCE=1 -c -o src/fsatrace.o src/fsatrace.c
Sat Feb 22 17:03 2020 Time and Allocation Profiling Report (Final)
rattle-benchmark +RTS -p -RTS make clean commands.txt
total time = 0.07 secs (73 ticks @ 1000 us, 1 processor)
total alloc = 26,502,832 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
try_ Control.Exception.Extra src/Control/Exception/Extra.hs:127:1-10 19.2 5.5
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2
2019-09-20 10:43:18.048133: [debug] Checking for project config at: C:\Neil\filepath\stack.yaml
2019-09-20 10:43:18.049133: [debug] Loading project config file stack.yaml
2019-09-20 10:43:18.055129: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2019-09-19 09:43:18.0551299 UTC]
2019-09-20 10:43:18.056129: [debug] Using package location completions from a lock file
2019-09-20 10:43:18.183056: [debug] Asking for a supported GHC version
2019-09-20 10:43:18.189047: [debug] Installed tools:
- msys2-20150512
- ghc-8.6.5
- ghc-8.6.4
{-# LANGUAGE TemplateHaskell #-}
-- | Try performing a Stack-like install.
module Test.Example.Stack(main) where
import Development.Rattle
import Development.Shake.FilePath
import System.IO.Extra
import Language.Haskell.TH
import qualified Data.ByteString as BS
@ndmitchell
ndmitchell / hoogle.html
Created May 21, 2019 09:20
Hoogle with the XSS vulnerability
<!DOCTYPE HTML>
<html>
<head profile="http://a9.com/-/spec/opensearch/1.1/">
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>'"><marquee style - Hoogle</title>
<meta name="robots" content="index" />
<link type="text/css" rel="stylesheet" href="https://rawcdn.githack.com/ndmitchell/hoogle/a4120ecd73ba7e1c215e3261ed9796cf6c8a9708/html/hoogle.css" />
<link rel="stylesheet" type="text/css" href="https://rawcdn.githack.com/ndmitchell/hoogle/a4120ecd73ba7e1c215e3261ed9796cf6c8a9708/html/plugin/chosen.css" />
<link type="image/png" rel="icon" href="https://rawcdn.githack.com/ndmitchell/hoogle/a4120ecd73ba7e1c215e3261ed9796cf6c8a9708/html/favicon.png" />
This file has been truncated, but you can view the full file.
Fri May 17 17:24 2019 Time and Allocation Profiling Report (Final)
demo +RTS -p -RTS
total time = 0.82 secs (824 ticks @ 1000 us, 1 processor)
total alloc = 736,329,896 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
tc_rn_src_decls TcRnDriver compiler\typecheck\TcRnDriver.hs:(493,4)-(557,7) 27.1 29.2