In the comments to Erlang Fractal Benchmark, Ulf Wiger noted in the comments that adding is_float
guard clauses speeds up the code.
When I asked why on the Erlang email list, Ulf and others explained: when the compiler sees is_float(X)
it knows that X
must be a float. Instead of worrying about type checks, casting, and other inefficiencies, it can optimize the code that uses X.
No comments:
Post a Comment