Of course the C code was a lot simpler, but still...
Of course, there are (still) pathological cases where a single line of code will abort because it runs out of time.
> cat too-complex.swift
let a:[Int] = [1] + [2] + [3] + [4] + [5] + [6] + [7]
For me, this aborts after about a minute and a half: > time swiftc too-complex.swift
too-complex.swift:1:49: error: expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions
let a:[Int] = [1] + [2] + [3] + [4] + [5] + [6] + [7]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
real 1m35.094s
user 1m16.698s
sys 0m5.141s
That appears to be some sort of exponential in type inference. Other similar ones have been fixed.The ternary expressions mentioned elsewhere also appear to be problematic, and in general, there's little time bombs all over just waiting to go off.
The rate I mentioned earlier was taken from a CocoaHeads talk by someone who built a caching mechanism for Carthage, because their Swift framework(s) of around 20KLOC were taking ages to compile.
So it's a real-world example, not something made up.
If I recall, it's in the implicit conversions, not strictly the type inference.
To compare a historical compiler with your Swift numbers: In 1989, Turbo C compiled 16K lines per minute on a ho-hum machine. The computers today, 30 years later, are more than 60x faster, so one would expect compilation speeds exceeding 16k per second of swift code. Turbo Pascal compiled about twice as fast as Turbo C at the time.
There are 60 seconds in a minute.
Wow, how common is this in practice? That sounds broken.
This is the active code repository of TCC: http://repo.or.cz/w/tinycc.git
- Mach-O binaries?
- ARM?
- Objective-C?
- ?
Is it just for fun, or could it be 'useful'? iOS categorically prohibits JIT, right?
It should be pretty easy to add Objective-C and C++ support, right? ( ͡° ͜ʖ ͡°)