Code Monkey home page Code Monkey logo

hs-opt-handbook.github.io's People

Contributors

doyougnu avatar hsyl20 avatar kisaragieffective avatar langston-barrett avatar siraben avatar ulysses4ever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hs-opt-handbook.github.io's Issues

Fusion and Rules pragma optimization chapter

relate to polymorphism and specialization. Be sure to show Stg and Core and give precise instructions on when we know something has not fused.

Add a here there be dragons quote for Rules. These come with some real downsides.

Using dtrace

I believe we can indeed use dtrace because of Ben's DWARF symbol implementation. Can we? Should we? This is the chapter to figure that out and write it down if it is indeed possible and useful.

Direct Observation: Reading STG

Should have:

- good patterns
- bad patterns and how to fix them
- description of all information dumped by core
- possibly description of unarisation?
- description of slow_ap and fast_ap and other machine fundamentals
- no-update or update lambda

for this and #13 make sure it connects to the user's vision of their code.

Chapter on memory layout

A user should be able to look at a ADT definition and know how many machine words are needed to represent that ADT in the worst case

Show a finer-grained table of contents in sidebar

According to the sphinx docs we should be able to do something like:

html_sidebars = { '**':
                  ['localtoc.html',
                   'relations.html',
                   'searchbox.html'
                   ]
                }

in conf.py, unfortunately for whatever reason this makes the landing page for the book (and every page actually) a blank white screen on chrome and firefox ๐Ÿคท

This ticket is done when:

  • We have a fine grained table of contents in the sidebar
  • It actually works without nuking all content in the book.

I suspect this is a css issue because the page source still contains the content of each .rst file. I bet the sidebar is expanding to the whole screen or something strange like that.

What makes Haskell programs slow down?

Write section in Forward.

Relevant part of the Proposal, I've tweaked some stuff and we'll probably need to refine this section

3. What makes Haskell programs slow down (in order of importance)
3.1 Doing more work than necessary <=> too much allocation
3.2 Fusion and why it sometimes fails
3.3 Too much polymorphism
3.4 Bad datastructures

Manual Worker/Wrapper Chapter

  • describe worker/wrapper
  • show a case when the optimization doesn't fire
  • show how to perform manually with a concrete example
  • take that concrete example and create a generic example
  • show the Core and Stg difference for both when worker/wrapper fires, when it doesn't and when done manually.

GHC Flags for CPU Measurement

Again, don't rewrite the manual but this is the place to discuss:

  • -prof
    and associated tools such as:
  • profiteur
  • viewprof
  • ghc-prof
  • profiterole

Linux time utility

The simplest of ways. Perhaps combine this with another tool if it is too short?

Ordering Data Constructors Chapter

This used to be important, not sure if GHC 9.X optimizes these away now. It might so need to verify. Case study on IntMap is here though, see the source code of containers for details.

Be sure to show Stg and Core too.

Valgrind chapter

The tools we use have a profound (and devious!) influence on our thinking habits, and, therefore, on our thinking abilities.

see:

read them, love them, they are quite good!

The Recipe

This should be a step-by-step list of how to debug a performance issue including some scientific method such as crafting hypothesis. There should be a list of key questions relating such as "is this error deterministic or stochastic" and stuff like that. Perhaps we start with a "What do we know" then "craft a hypothesis" then "test the hypothesis"

Heap Profiling with GHC

1.1.1 heap profiling (most importantly what to look for, e.g., classic
triangle implies memory leak): -hT -hC -hy etc.

Make a Guideline section

Section should be small bite size snippets of recommendations for performance:

  1. Use strict data
  2. unpack strict fields if you don't need laziness
  3. let GHC optimize for you, except in extremely hot loops where your effort is worth it
  4. only use lists as a stack
    etc.

each one should have a variable and name associated so they can be linked throughout the text.

Direct Observation: Reading Core chapter

from the proposal

1.5 Direct Observation: Reading Core (and relating core to program behavior in detail)
1.5.1 Preliminaries: z-encoding, dumping and navigating core 
1.5.2 What allocation in Core looks like
1.5.3 Bad patterns in Core
1.5.4 Good patterns in Core
1.5.5 Demand analysis
1.5.6 Simplifier data in Core
1.5.7 Occurrence analysis 
1.5.8 Others?

SBV case study

For excessive closure allocation. See LeventErkok/sbv#572

be sure to update the Programs of consistent Lethargy Excessive closure allocation section to link to the case study

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.