julia icon indicating copy to clipboard operation
julia copied to clipboard

[v3] Implement new Concept Exercise: performance

Open SaschaMann opened this issue 5 years ago • 0 comments

This issue describes how to implement the performance concept exercise for the Julia track.

Goal

The goal of this exercise is to teach the student how to avoid common performance gotchas by refactoring slow code.

Motivation

It is very common that people try out Julia, convert Python or Matlab code to it, and then wonder why they aren't seeing the promised performance benefits. Most of these issues are due to a handful of common mistakes. By teaching about these, this frustrating experience can be avoided.

Things to teach

  • Avoiding global variables
  • Avoiding containers with abstract type parameters
  • Avoiding type-unstable code
  • How to identify performance issues
  • Why the above should be avoided

Things not to teach

  • Microoptimisations such as using @inbounds, muladd etc.

Concepts

  • performance
  • performance-analysis
  • profiling
  • code-inspection
  • type-stability
  • scopes
  • abstract-types

Prerequisites

This exercise likely fits best towards the end of the track, so you can assume all concepts are known. Please list them explicitely after implementing the exercise.

Additional notes

The testsuite should ensure that the refactored solution still works. However, automatically testing if all performance issues have been found is likely impossible. The student should instead be provided with reference values for how much of a speed up can be reached, e.g. the original solution takes 1000x longer than the improved solution. The after.md file should provide a list of all issues that could be found as well as an example solution, so that the student can check themselves if they found everything.

Resources to refer to

Hints

  • List tools that the student can use to identify performance problems, e.g. Profilers, Traceur.jl, @code_warntype

Implementing

Help

If you have any questions while implementing the exercise, please post the questions as comments in this issue.

SaschaMann avatar Jan 25 '20 13:01 SaschaMann