-
Notifications
You must be signed in to change notification settings - Fork 251
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
Replace for
with cfor
in the Scala code for improved performance
#439
Comments
We not like such optimizations. We try to use standard language constructs and containers. If |
Performance-sensitive code usually switches to either while-loops or tail recursive functions. Scala developers usually don't care about for-loops being slow because they are used mostly for monadic binding (i.e. Scala for-comprehensions are analogues of Haskell do-comprehensions and not just loops). |
Numerical
for
loops in Scala are known to be slower than their counterparts in other languages, and also generate more garbage, because they are implemented as a composition of very high-level language constructs; details can be found here and here, for instance. This is why the Spires library provides thecfor
macro, which implements loops in a significantly more efficient way.With the above rationale, would the maintainers of this repository agree to the replacing of
for
withcfor
, for improved performance of the benchmarked Scala code?The text was updated successfully, but these errors were encountered: