prosseek
prosseek

Reputation: 191169

Are typed functional languages faster?

I heard the binary compiled from typed functional languages runs faster than otherwise. Is it true?

If so, why is that? Normally, do typed languages produce faster binaries?

Upvotes: 3

Views: 309

Answers (2)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799450

A statically-typed language can produce tighter, faster code because it does not have to do type lookups at every operation. This is true regardless of whether the language is functional, procedural, object-oriented, or imperative.

Upvotes: 8

Joel Martinez
Joel Martinez

Reputation: 47809

In general, the reason typed languages perform better is because you know everything about the types at compile time, which lets the compiler make certain optimizations based on assumptions about type.

so, in general ... yes, it would be faster ... but of course there's always caveats when perf is concerned :-)

Upvotes: 2

Related Questions