Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpo: refactor to bottom-up design #100

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-shell --run 'cabal update; make clean; make html SPHINXOPTS="-W"'
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- run: nix build
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
SOURCE_DATE_EPOCH = $(shell git log -1 --format=%ct)

# Put it first so that "make" without argument is like "make help".
help:
Expand Down
1 change: 0 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
## underscore
, 'sphinxcontrib.bibtex'
, 'sphinx_copybutton'
# , 'sphinxcontrib.execHS.ext'
, 'sphinx_exec_directive'
, 'conceptual_admonitions'
]
Expand Down
88 changes: 20 additions & 68 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 10 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
url = "github:edolstra/flake-compat";
flake = false;
};
sphinx-exec-haskell.url = "github:doyougnu/sphinx-exec-haskell";
};

outputs = { self, nixpkgs, flake-utils, flake-compat, sphinx-exec-haskell }:
outputs = { self, nixpkgs, flake-utils, flake-compat }:
let press-theme-overlay = final: prev: {
sphinx-press-theme = prev.python310Packages.buildPythonPackage rec {
sphinx-press-theme = prev.python311Packages.buildPythonPackage rec {
pname = "sphinx_press_theme";
version = "0.8.0";

src = prev.python3Packages.fetchPypi {
src = prev.python311Packages.fetchPypi {
inherit pname;
inherit version;
sha256 = "sha256-KITKqx3AHssR0VjU3W0xeeLdl81IUWx2nMJzYCcuYrM=";
Expand All @@ -26,37 +25,33 @@
};

copy-button-overlay = final: prev: {
sphinx-copybutton = prev.python310Packages.buildPythonPackage rec {
sphinx-copybutton = prev.python311Packages.buildPythonPackage rec {
pname = "sphinx-copybutton";
version = "0.5.0";
version = "0.5.2";

src = prev.python3Packages.fetchPypi {
src = prev.python311Packages.fetchPypi {
inherit pname;
inherit version;
sha256 = "sha256-oMBZ2q3QPCe6dQ2lNKkqY+ejanc23PaE8m7jRhmXh/Y=";
sha256 = "sha256-TPF8gvuWRtG8nKkqwoCBOjtgXYxCEiX9mRMVQQPuH70=";
};
propagatedBuildInputs = [ prev.sphinx ];
};
};

sphinx-exec-directive-overlay = final: prev: {
sphinx-exec-directive = prev.python310Packages.buildPythonPackage rec {
sphinx-exec-directive = prev.python311Packages.buildPythonPackage rec {
pname = "sphinx-exec-directive";
version = "0.6";

src = prev.python310Packages.fetchPypi {
src = prev.python311Packages.fetchPypi {
inherit pname;
inherit version;
sha256 = "sha256-lMo4QILqt6pEiIatN/LNxhiUGX3ziSWV+bfRahzmZWU=";
};
propagatedBuildInputs = [ prev.sphinx prev.python310Packages.matplotlib ];
propagatedBuildInputs = [ prev.sphinx prev.python311Packages.matplotlib ];
};
};

sphinx-exec-haskell-overlay = system: final: prev: {
sphinx-exec-haskell = sphinx-exec-haskell.packages.${system}.default;
};

in
flake-utils.lib.eachDefaultSystem
(system:
Expand All @@ -65,7 +60,6 @@
overlays = [ press-theme-overlay
copy-button-overlay
sphinx-exec-directive-overlay
(sphinx-exec-haskell-overlay system)
];
} ;

Expand Down
16 changes: 9 additions & 7 deletions hoh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
}:

let
pythonInputs = with pkgs.python310Packages; [
pythonInputs = with pkgs.python311Packages; [
sphinx
sphinxcontrib-bibtex
sphinxcontrib-tikz
sphinx-autobuild
pip
# marked as broken in nixpkgs unfortunately
# sphinx-book-theme
## until we have a reason for tex leave this commented out for CI
# ourTexLive
];
nonPythonInputs = with pkgs; [ sphinx-press-theme # this comes from the overlay
sphinx-copybutton # this comes from the overlay
pandoc
# pandoc
# change once extension fixes are upstreamed
# sphinx-exec-directive
sphinx-exec-directive
rst2html5
sphinx-autobuild
sphinx-exec-haskell
ghc
cabal-install
git
Expand All @@ -29,14 +29,16 @@ pkgs.stdenv.mkDerivation {
pname = "hoh";
version = "0.0.1";
src = ./.;
propagatedBuildInputs = pythonInputs ++ nonPythonInputs;
buildInputs = pythonInputs ++ nonPythonInputs;

preBuild = ''
SOURCE_DATE_EPOCH="$(${pkgs.coreutils}/bin/date '+%s')"
unset SOURCE_DATE_EPOCH
'';

buildPhase = ''
runHook preBuild
SOURCE_DATE_EPOCH="$(${pkgs.coreutils}/bin/date '+%s')"
make clean
make ${target} SPHINXOPTS="-W"
touch "_build/.nojekyll"
touch "_build/html/.nojekyll"
Expand Down
8 changes: 4 additions & 4 deletions src/Case_Studies/klister.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ This chapter is a case study on a first pass of performance engineering for the
|klister| programming language interpreter. This case study should be exemplary
of any system which is shortlived, has distinct phases of input and output, and
maintains state. To diagnose the performance issues this case study uses
:ref:`Heap Profiling <Heap Profiling Chapter>` with :ref:`Eventlog <EventLog
:ref:`Heap Profiling <Haskell GHC Flags>` with :ref:`Eventlog <EventLog
Chapter>`, :ref:`Info Table Profiling <IPE Chapter>`, :ref:`TickyTicky <Ticky
Chapter>` profiling. The optimizations are trivial: choosing better data
structures and closing memory leaks; any intermediate level Haskeller should be
able to follow along. After reading this chapter, a reader should be able to
spot inefficient data structure use by reading code, and GHC's profiling tools
to diagnose memory performance issues and identify hot code. To read through the
code, `this commit
<https://github.com/gelisam/klister/commit/33501b2233ce865407a8a3ca7c090457f3375442>`_
<https://github.com/gelisam/klister/commit/33501b2233ce865407a8a3ca7c090457f3375442>`__
is the result of the case study, and `this commit
<https://github.com/gelisam/klister/tree/5aea4d2b9df8f6e9db276078570c1e1bd1306cd3>`_
<https://github.com/gelisam/klister/tree/5aea4d2b9df8f6e9db276078570c1e1bd1306cd3>`__
was the state of the klister code base that the tutorial starts with.

The rest of the chapter is structured as follows. We introduce the |klister|
Expand Down Expand Up @@ -1464,7 +1464,7 @@ Then we employed a number of methods to find performance problems. We used:

* :ref:`Ticky Profiling <Ticky Chapter>`: To determine hot loops and highly
allocating functions
* :ref:`Biographical/Retainer Profiling <Heap Profiling Chapter>`: To determine
* :ref:`Biographical/Retainer Profiling <Haskell GHC Flags>`: To determine
the source of memory leaks in the expander state. This technique led our
analysis to the lazy return in ``currentEnv``.
* :ref:`Info-Table Profiling <IPE Chapter>`: To determine the line of code
Expand Down
13 changes: 13 additions & 0 deletions src/Measurement_Observation/Binary_Profiling/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Binary Profiling and Probing
----------------------------

.. toctree::
:maxdepth: 2
:glob:
:name: binary_prof

linux_time
linux_perf
dtrace
valgrind
cachegrind
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _Perf Chapter:

:lightgrey:`The perf utility`
=============================
:lightgrey:`The Linux perf utility`
===================================

`TODO <https://github.com/input-output-hk/hs-opt-handbook.github.io/issues/30>`_
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. Time

:lightgrey:`The time Utility`
=============================
:lightgrey:`The Linux time command`
===================================

`TODO <https://github.com/input-output-hk/hs-opt-handbook.github.io/issues/31>`_
9 changes: 9 additions & 0 deletions src/Measurement_Observation/Cmm_Profiling/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Cmm Probes and Profiling
------------------------

.. toctree::
:maxdepth: 2
:glob:
:name: cmm_prof

cmm
10 changes: 10 additions & 0 deletions src/Measurement_Observation/Core_Profiling/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Core Probes and Profiling
-------------------------

.. toctree::
:maxdepth: 2
:glob:
:name: core_prof

core
size
12 changes: 0 additions & 12 deletions src/Measurement_Observation/Direct_Observation/index.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _Heap Profiling Chapter:
.. _Haskell GHC Flags:

:lightgrey:`GHC Flags`
======================
Expand Down
Loading