-
Notifications
You must be signed in to change notification settings - Fork 81
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
fwiw my new mistakes #2173
Comments
For the division, Toit is in "good" company. Lots of languages have int / int -> int, but float / int->float and int / float -> float. For the indentation: you get used to it :), and eventually appreciate that you don't need to declare your indent twice (with delimiters and indentation). Fwiw, as a human, you also run in the opposite issue, where code (in a delimited language) was misread because of the indentation. See https://developers.redhat.com/blog/2016/02/26/gcc-6-wmisleading-indentation-vs-goto-fail. That said: in delimited languages the compiler can warn you. In Toit indentation is the only way to declare indent. I do think that transliterating makes this worse, as you don't necessarily think about the purpose of the code. |
And thanks for the feedback. |
fwiw I see 2x on linux
|
Fannkuch is a microbenchmark that only exercises a small part of the interpreter. Depending on the implementation there are typically almost no classes and virtually no method calls. Deltablue and Richards are benchmarks that are much more representative of real-word applications. In other words: some operations in Toit run roughly at the same speed as MicroPython. Others are significantly faster. For typical applications, with classes and method calls, the difference becomes more pronounced. Microbenchmarks typically only test loop operations and number-crunching which Toit isn't as optimized for. |
Perhaps because I'm transliterating programs written in other languages into Toit, the mistakes surprise me a little.
In the original program
/
converted to float division but in the transliterated Toit program was interpreted as int division so the program mysteriously produced unexpected output.Indented a statement 2-spaces too many which put the statement inside a loop so the program mysteriously produced unexpected output.
The text was updated successfully, but these errors were encountered: