Replies: 2 comments 4 replies
-
@KieranP Thanks for the feedback, this is really helpful 😃
This is a good point: it seems I completely forgot to cover
You're right that performance isn't great. I haven't spent a lot of time optimizing things yet and the LLVM IR we produce is horrible. I suspect that even with aggressive optimizations enabled, LLVM has a hard time improving things. In particular, functions aren't inlined at all: LLVM IIRC can't inline across separate modules, and we don't do any inlining on our own IR just yet. In addition, I suspect we're probably not providing enough metadata in the LLVM IR for LLVM to do a good job of optimizing things. Fortunately, all of this can be solved (i.e. it's not some fundamental language problem), we just haven't gotten there yet 😄 The following issues are worth keeping an eye on:
These features probably won't make it into the language. Static fields wouldn't work well as this results in global mutable state, which is exactly what we don't want in Inko. Default values for fields isn't terribly useful as you can simply use static/factory methods for that. Default argument values is something we used to have a long time ago, but it was removed due to how this complicates code generation and type checking. This may be reintroduced at some point, but there are no concrete plans for it at this stage.
There are a few ways you can do this: Using ranges (mostly useful if you want to e.g. map values):
Using
You can do this as follows:
I'll be working on #333 in the coming 2-3 months (currently working on #334, so not sure yet when I'll start), which should make it a lot easier to work with the standard library 😄 |
Beta Was this translation helpful? Give feedback.
-
I ran a very quick profiling session using
I'm pretty sure what we're seeing here is just the cost of function calls that aren't inlined, and so once that's solved I'm sure this implementation will perform much better. |
Beta Was this translation helpful? Give feedback.
-
I've just finished porting my Conway's Game of Life implementation (GOL) to Inko. You can view the result here: https://github.com/KieranP/Game-Of-Life-Implementations/tree/master/inko
Here are my initial impressions after finishing. Feel free to take it with a grain of salt. All the best as you continue to develop the language.
The language design reminds me of Rust in a lot of ways, minus the lifetimes and easier/less in your face borrowing/moving mechanic. Nice work.
Documentation is sparse - for example, I couldn't find anything on the website about how to use Arrays, Maps, or Options. I had to dive into the source code to find out. Thankfully the std library is well documented and easily to follow. Would be helpful if this was published.
Performance is lacking. Even with aggressive optimisations enabled, Inko sadly currently ranks as 2nd to last in my GOL rankings. The majority of the time appears to be in a method which makes a lot of calls to
map.opt()
and unwrapping the result. I use the same approach in other compiled language implementations, and they are about 20x-25x faster. So some room for improvement there. Feel free to use my implementation for profiling and optimising if you so wish.Inko is lacking some language features compared to other mainstreams, namely class static fields (e.g.
let static @field = ...
), class instance field default values (e.g.let pub @tick = 0
), method default values (e.g.add_cell(alive: Bool = false)
), and a clearer way to loop X times than what I'm currently doing:Perhaps something like:
Anyway, thanks for reading. All the best and will keep an eye on future releases.
Beta Was this translation helpful? Give feedback.
All reactions