Shake Before Building Replacing Make with Haskell community.haskell.org/~ndm/shake Neil Mitchell.

Slides:



Advertisements
Similar presentations
Inpainting Assigment – Tips and Hints Outline how to design a good test plan selection of dimensions to test along selection of values for each dimension.
Advertisements

Lecture 3 Getting Started with ITK!. Goals for this lecture Learn how to use Cmake Build ITK Example programs that use ITK.
The Assembly Language Level
CSc 352 An Introduction to the C Preprocessor Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
Using Cabal and the Hackage Package Database. Hackage Hackage is a database of Haskell packages (or modules) written by others and available for public.
David Notkin Autumn 2009 CSE303 Lecture 20 static make.
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
Reasons to study concepts of PL
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
Portability CPSC 315 – Programming Studio Spring 2008 Material from The Practice of Programming, by Pike and Kernighan.
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
How SQL Monitor can benefit your business. SQL Monitor How can it benefit your business? SQL Monitor is a SQL Server performance monitoring tool.  It’s.
CSE 403 Lecture 11 Static Code Analysis Reading: IEEE Xplore, "Using Static Analysis to Find Bugs" slides created by Marty Stepp
Neil Mitchell Gluing things together with Haskell.
Groovy WHAT IS IT? HOW DOES IT WORK? IS IT USEFUL?
1 Sandcastle Documentation Compilers For Managed Class Libraries common) Enabling managed class library developers throughout the world to easily create.
July 29, 2003Serguei Mokhov, 1 Makefile Brief Reference COMP 229, 346, 444, 5201 Revision 1.2 Date: July 18, 2004.
1 History of compiler development 1953 IBM develops the 701 EDPM (Electronic Data Processing Machine), the first general purpose computer, built as a “defense.
Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.cpp.
The Structure of a C++ Program. Outline 1. Separate Compilation 2. The # Preprocessor 3. Declarations and Definitions 4. Organizing Decls & Defs into.
Functional Programming Universitatea Politehnica Bucuresti Adina Magda Florea
Building stuff with monadic dependencies + unchanging dependencies + polymorphic dependencies + abstraction Neil Mitchell
Scons Writing Solid Code Overview What is scons? scons Basics Other cools scons stuff Resources.
AliRoot Implementation of native CMake build system A. Grigoras, P. Hristov 19/11/20141Alice - CMake.
Sexy Science User Interfaces June 17, 2011 GRITS III, Pasadena, CA John Good.
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 12/6/2006 Lecture 24 – Profilers.
C Tutorial - Program Organization CS Introduction to Operating Systems.
Compilation & Linking Computer Organization I 1 November 2009 © McQuain, Feng & Ribbens The Preprocessor When a C compiler is invoked, the.
1 Introduction to Classes and Objects Chapter 3 Introduction to Classes and Objects Chapter 3.
Design + Production Presented by Robin Walker. Design + Production  Half-Life 2 development process  Half-Life The cabal.
1 Topics for this Lecture Build systems Static analysis.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
Cove: A Practical Quantum Computer Programming Framework Matt Purkeypile (DCS3) Winter 2009.
Copyright © 2015 Curt Hill Make An Indispensable Developer’s Tool.
High-Speed Policy-Based Packet Forwarding Using Efficient Multi-dimensional Range Matching Lakshman and Stiliadis ACM SIGCOMM 98.
SCons: Big Signature Refactoring 18 April Build tools do TWO things Build things in the correct order NOT build what’s up to date.
C code organization CSE 2451 Rong Shi. Topics C code organization Linking Header files Makefiles.
Build Tools 1. Building a program for a large project is usually managed by a build tool that controls the various steps involved. These steps may include:
Brandon Packard. Why make? So far, you have probably worked on relatively small projects Coding projects can become huge My research consists of 1600.
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/11/2006 Lecture 7 – Introduction to C.
Haskell With Go Faster Stripes Neil Mitchell. Catch: Project Overview Catch checks that a Haskell program won’t raise a pattern match error head [] =
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
1 Programming and problem solving in C, Maxima, and Excel.
LINKED LISTS.
First appeared Features Popular uses Basic This language emphasises on ease of use, allowing general purpose programming to those with a small amount of.
Software development tools
Multiple file project management & Makefile
The language focusses on ease of use
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
C – Multi-file development and make
CASE STUDY 1: Linux and Android
Beginning C++ Programming
CPSC 315 – Programming Studio Spring 2012
History of compiler development
The Preprocessor Based on Chapter 1 in C++ for Java Programmers by Weiss When a C compiler is invoked, the first thing that happens is that the code is.
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
Prof: Dr. Shu-Ching Chen TA: Yimin Yang
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Compiler Construction
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Portability CPSC 315 – Programming Studio
ns-3 Waf build system ns-3 Annual Meeting June 2017
CSc 352 An Introduction to the C Preprocessor
Build Tools (make) CSE 333 Autumn 2018
Advanced Compiler Design
Performance and Code Tuning Overview
Understanding DLLs and headers, and libs… Jeff Chastine.
SPL – PS1 Introduction to C++.
Presentation transcript:

Shake Before Building Replacing Make with Haskell community.haskell.org/~ndm/shake Neil Mitchell

General Purpose Build Systems + Rules  Visual Studio  ghc –make  Cabal  make  Cmake  Scons  Waf  Ant  Shake

Generated files Foo.xml Foo.c MyGenerator Foo.o …headers… What headers does Foo.c import? (Many bad answers, exactly one good answer)

Dependencies in Shake Fairly direct – What about in make? "Foo.o" *> \_ -> do need ["Foo.c"] (stdout,_) <- systemOutput "gcc" ["-MM","Foo.c"] need $ drop 2 $ words stdout system' "gcc" ["-c","Foo.c"]

Make requires phases Foo.mk : Foo.c gcc –MM Foo.c > Foo.mk #include Foo.mk Foo.o : $(shell sed … Foo.xml) Foo.o : Foo.c gcc –c Foo.o Disclaimer: make has hundreds of extensions, none of which form a consistent whole, but some can paper over a few cracks listed here

Dependency differences Make – Specify all dependencies in advance – Generate static dependency graph Shake – Specify additional dependencies after using the results of previous dependencies D shake > D make

A build system with a static dependency graph is insufficient A build system with a static dependency graph is insufficient

Build system Better dependencies Modern engineering + Haskell Shake Syntax Types Abstraction Libraries Monads Profiling Lint Analysis Parallelism Robustness Efficient

Identical performance to make Profiling

Shake at Standard Chartered In use for 3 years – 1M+ build runs, 30K+ build objects, 1M+ lines source, 1M+ lines generated Replaced 10,000 lines of Makefile with 1,000 lines of Shake scripts – Twice as fast to compile from scratch – Massively more robust Disclaimer: I am employed by Standard Chartered Bank. This paper has been created in a personal capacity and Standard Chartered Bank does not accept liability for its content. Views expressed in this paper do not necessarily represent the views of Standard Chartered Bank.

*for one real example Shake vs make: 10x shorter, 2x faster* Shake vs make: 10x shorter, 2x faster*

Faster 1 of 4: Less work gcc -MM finding headers has bad complexity – At large enough scale, it really matters A.h B.h Headers.h Foo.c Bar.c Baz.c C.h Scan each header once, instead of once per inclusion

Faster 2 of 4: Less rebuilds Foo.xml Foo.c MyGenerator Foo.o …headers… commit decea285a863ff147f53d3748aac8b13 Author: Neil Mitchell Comment: MyGenerator, whitespace only

Faster 3 of 4: More parallelism Big project ≈ perfect parallelism – No unnecessary dependencies – Depend on only part of a file – No phases (overly coarse dependencies)

Faster 4 of 4: Better parallelism Random thread pool = 20% faster – Avoid all compiles then all links CompilingLinking

Shake outside a bank At least 10 Haskell build libraries – 3 are Shake inspired implementations 2 Shake addon libraries There’s a bit of scaffolding to get going, but the flexibility is really worth it to be able to handle auto-generated files easily. Abba Coadjute Cake Hmk OpenShake Blueprint Cake Hake Nemesis Zoom

More information ICFP paper Hackage (shake)