Skip to content

Instantly share code, notes, and snippets.

View chessai's full-sized avatar

chessai chessai

View GitHub Profile
me: she flipped my life on its head
therapist: im sorry
me: my world was turned upside down
therapist: mmhmm
me: so id like to take a minute, just sit right there
therapist: dont
me: ill tell you how i became the prince
therapist: we talked about this
me: of a town called despair
[nix-shell:~/development/freq]$ cabal new-build
Build profile: -w ghc-8.4.1 -O1
In order, the following will be built (use -v for more details):
- freq-0.1.0.0 (lib) (file src/Freq/Internal.hs changed)
- freq-0.1.0.0 (exe:freq-train) (configuration changed)
Preprocessing library for freq-0.1.0.0..
Building library for freq-0.1.0.0..
[1 of 2] Compiling Freq.Internal ( src/Freq/Internal.hs, /home/dcartwright/development/freq/dist-newstyle/build/x86_64-linux/ghc-8.4.1/freq-0.1.0.0/build/Freq/Internal.o )
[2 of 2] Compiling Freq ( src/Freq.hs, /home/dcartwright/development/freq/dist-newstyle/build/x86_64-linux/ghc-8.4.1/freq-0.1.0.0/build/Freq.o ) [Freq.Internal changed]
Configuring executable 'freq-train' for freq-0.1.0.0..
eigen:
- no statitically checked dimensions
- make this a newtype wrapper, a functor,
so the underlying thing can be anything
- no kronecker product
- express certain properties of a matrix at
the type level (positive-definite, etc)
- encode things like:
- 'a `transpose` a' for
- any real invertible matrix 'a' is positive-definite

These are libraries that I have worked on but not released. Almost all of them are nearly to the point of being ready for release. If I aim for one release a day, I think the quality of releases will be good and maintainable.

wizard

proxy

freq

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE KindSignatures #-}
I am admittedly unsure of how GHC's optimisation benchmarks are currently implemented/carried out, but I feel as though this paper and its findings could be relevant to GHC devs:
http://cis.upenn.edu/~cis501/papers/producing-wrong-data.pdf
Basically, according to this paper, the cache effects of changing where the stack starts based on the number of environment variables are huge for many compiler benchmarks, and adjusting for this effect shows that gcc -O3 is only in actuality 1% faster than gcc -O2.
Some further thoughts, per http://aftermath.rocks/2016/04/11/wrong_data/ :
"The question they looked at was the following: does the compiler’s -O3 optimization flag result in speedups over -O2? This question is investigated in the light of measurement biases caused by two sources: Unix environment size, and linking order.
to the total size of the representation of Unix environment variables (such as PATH, HOME, etc.). Typically, these variables are part of the memory image of each process. The call stack beg
this file was empty, this line exists because github complained at me
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" height="340" width="482" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.11.1"><path d="M 0.0000,340.0000 L 113.0000,170.0000 L 0.0000,0.0000 L 85.0000,0.0000 L 198.0000,170.0000 L 85.0000,340.0000 L 0.0000,340.0000 ZM 0.0000,340.0000 " fill="#352950"/><path d="M 113.0000,340.0000 L 226.0000,170.0000 L 113.0000,0.0000 L 198.0000,0.0000 L 425.0000,340.0000 L 340.0000,340.0000 L 269.0000,234.0000 L 198.0000,340.0000 L 113.0000,340.0000 ZM 113.0000,340.0000 " fill="#4A3A74"/><path d="M 387.0000,241.0000 L 350.0000,184.0000 L 482.0000,184.0000 L 482.0000,241.0000 L 387.0000,241.0000 ZM 387.0000,241.0000 " fill="#7C3679"/><path d="M 331.0000,156.0000 L 293.0000,99.0000 L 482.0000,99.0000 L 482.0000,156.0000 L 331.0000,156.0000 ZM 331.0000,156.0000 " fill="#7C3679"/></svg>
import Data.List (partition)
average2 :: (Fractional a) => a -> a -> a
average2 x y = (x + y) / 2
median :: Ord a => [a] -> Maybe a
median xs
| even n = Nothing
| otherwise = select (n `div` 2) xs
where
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
module Data.Diet.Map where
import qualified Data.Sequence as Seq
import Data.Sequence (Seq, ViewL(..), (<|), (><))