-
Notifications
You must be signed in to change notification settings - Fork 52
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
robot wave scenario #1556
robot wave scenario #1556
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff @kostmo, I could see this turn into a full Arcade run with multiple levels. 🚀
data/scenarios/Challenges/wave.yaml
Outdated
dsl: | | ||
overlay | ||
[ {dirt, water} | ||
, if x % 7 + y % 5 == 0 then {dirt, wavy water} else {blank} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I like the repeating pattern, it looks like old school games. 🎮
def doN = \n. \f. if (n > 0) {f; doN (n - 1) f} {}; end; | ||
|
||
def crossPath = | ||
doN 6 move; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this is needlessly slow because we do not inline it.
doN 6 move; | |
// doN 6 move; | |
move; move; move; move; move; move; |
I also tried replacing But do not do this, I measured it and wait
with turn forward
.wait
is better!
Subjectively, the simulation seemed to keep playing better without lag on my computer once inlined.
EDIT: I will try to rebuild with profiling enabled and see if the difference is measurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just following a blog post about profiling with cabal, I can see some difference in the graphs:
Non-Inlined | Inlined |
---|---|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xsebek Great work looking at performance, memory profiling, etc.! We haven't paid much attention to it so far but I'm sure there is tons of low-hanging fruit to improve performance.
I'm not sure inlining things in scenario programs is the right way to go, though. Ideally we should be able to encourage nice, modular code and work hard to make that nice, abstracted, modular code run fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x............................................................................................................................................................................................................................................................x | ||
xxx........................................................................................................................................................................................................................................................xxx | ||
xxxxxxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwxxxxxx | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be a bit shorter? Though it does work well as a performance test. 😅
Co-authored-by: Ondřej Šebek <[email protected]>
Demo