12 ms·
That complicated type system w/ type inference does come with it's own costs, usually bad compile speed issues. It's what I've noticed when looking at language
by woolvalley 9y ago
That complicated type system w/ type inference does come with it's own costs, usually bad compile speed issues. It's what I've noticed when looking at languages like swift, rust, scala & haskell.
I'm currently dealing with it in a large swift project, and I would much rather go back to the extra verbosity of objective-c than have type inference at this point.
But that was insightful, thank you!
- Jeff_Brown 9y agoHave you noticed slow compiling with Haskell specifically?
- woolvalley 9y agoI've only used swift at that size, but I've heard stories with all of those languages once you have a large code base. I remember vaguely reading about how at a haskell conference people were basically cornering compiler maintainers about compile speed, but that was several years ago.
- Jeff_Brown 9y agoWhen I have to recompile, it's usually because I've only modified a few files, and it's usually really fast. I particularly enjoy that if I refactor things without actually making any changes in the way it works, GHC won't blink; it knows there's nothing to do. My codebase is only a few thousand lines, though.
- woolvalley 9y agoYeah the codebases I'm talking about are something around 1 million lines over several apps, libraries, all of the tests and codegened models, mocks and network services.
- yawaramin 9y agoCheck out OCaml (BuckleScript or ReasonML on the frontend, depending on which syntax you prefer). It has a super-fast compiler with almost total global type inference. The Facebook Messenger team report incremental builds of less than a second.
- zenhack 9y agoThe type system is probably not the bottleneck in any of those cases. As a sibling comment points out, ocaml has very good compile times, and the inference problem is basically the same as in Haskell. In the case of rust, I suspect one of the biggest issues is the way parametric polymorphism is implemented. Basically, if in your program you end up using e.g. Box<usize>, Box<MyType> and Box<Result<String>>, you're compiling Box 3 times. I don't know enough about swift to hazard a guess as to where the build is spending its time. My experience with Haskell is that compile times are neither great nor terrible.
- justinhj 9y agoData point : I’m working on a several hundred thousand line server using Scala. The incremental compile time is usually 2 or 3 seconds. A clean build of the project is around 2 minutes