Skip to content

Commit 65a790c

Browse files
committed
Lab7: Expanded text.
Added ref to lab5
1 parent fab400a commit 65a790c

File tree

3 files changed

+250
-136
lines changed

3 files changed

+250
-136
lines changed

docs/src/lecture_05/lab.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Lab 05: Practical performance debugging tools
1+
# [Lab 05: Practical performance debugging tools](@id perf_lab)
22
Performance is crucial in scientific computing. There is a big difference if your experiments run one minute or one hour. We have already developed quite a bit of code, both in and outside packages, on which we are going to present some of the tooling that Julia provides for finding performance bottlenecks. Performance of your code or more precisely the speed of execution is of course relative (preference, expectation, existing code) and it's hard to find the exact threshold when we should start to care about it. When starting out with Julia, we recommend not to get bogged down by the performance side of things straightaway, but just design the code in the way that feels natural to you. As opposed to other languages Julia offers you to write the things "like you are used to" (depending on your background), e.g. for cycles are as fast as in C; vectorization of mathematical operators works the same or even better than in MATLAB, NumPy.
33

44

docs/src/lecture_07/hw.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ world = @ecosystem begin
1414
@add 3 Wolf # adds 5 wolf with random sex
1515
end
1616
```
17+
`@add` should not be treated as a macro, but rather just as a syntax, that can be easily matched.
18+
1719
As this is not a small task let's break it into 3 steps
1820
1. Define method `default_config(::Type{T})` for each `T` in `Grass, Wolf,...`, which returns a tuple of default parameters for that particular agent.
1921
2. Define method `_add_agents(max_id, count::Int, species::Type{<:Species})` and `_add_agents(max_id, count::Int, species::Type{<:AnimalSpecies}, sex::Type{<:Sex})` that return an array of `count` agents of species `species` with `id` going from `max_id+1` to `max_id+count`. Default parameters should be constructed with `default_config`.
2022
3. Define the underlying function `_ecosystem(ex)`, which parses the block expression and creates a piece of code that constructs the world.
2123

22-
!!! info "`Type{T}` type"
23-
Some hints about this signature, which we have not yet introduced.
24-
2524
You can test the macro (more precisely the `_ecosystem` function) with the following expression
2625
```julia
2726
ex = :(begin

0 commit comments

Comments
 (0)