News for hackers. Stuff that matters.
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by mhh__ on Thursday June 22, 2017 @01:22PM (#14613790)
Optimizing compilers are purely an implementation detail of a language: This shouldn't leak into the language (If that's what you meant)
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by lmm on Thursday June 22, 2017 @06:49PM (#14615909)
I used to think that, but I no longer do. Most code is plenty fast enough already, sure, but for the cases where performance is a requirement, it needs to be exposed and accessible in a way that the developer can work with it, the same way as for any other feature. Compare what's happened with 3D graphics APIs - OpenGL tried to abstract over the hardware capabilities and give the illusion that your card was always capable of everything, but actually that just resulted in developers having to almost reverse engineer what the OpenGL implementation was doing so that they could find out what the actual hardware fast path was and use it. So newer APIs concentrate on exposing more of the hardware details and giving the developer more precise control over what's going on.
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by mhh__ on Thursday June 22, 2017 @08:17PM (#14616275)
That's the language design/philosophy, not specific details of how it was implemented.
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by lmm on Friday June 23, 2017 @06:04AM (#14618070)
What distinction are you drawing? I think concerns like "this operation is O(n^2) in the length of the passed list" are absolutely the responsibility of the language, and probably even lower-level details. I'm not sure how to expose "this operation takes n machine-code instructions" without sacrificing cross-platformness, but I do think that's something we're going to need for important use cases (e.g. cryptographic libraries need to be able to do various things in constant time, which no existing language really has first-class support for).
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by steveklabnik on Thursday June 22, 2017 @01:43PM (#14613944)
This is true in many cases, but there's subtleties.

Rust was designed to be optimized; this means unoptimized Rust code can easily be 2x-100x slower than optimized code. Given that speed is one of Rust's goals, yeah, you could implement a Rust compiler with no optimization, and that's fine. But it won't be usable to a significant chunk of users who rely on the speed.

Another way this can affect language design: Rust supports enums, which are a sum type. The memory layout of the enum is undefined at the language level. This is specifically so that compilers can do optimizations to make layout more compact than a naive implementation. In some sense, this is leaking optimization concerns out into language design.

Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by mhh__ on Thursday June 22, 2017 @02:24PM (#14614237)
I was imagining direct language ties to (say) LLVM passes, and things like that.

Designing the language around optimizability is a good thing, e.g. C++'s "as if" rule (in [intro.execution] in standards after C++11 (or near there)). Some of these options, which may or may not be used for optimization, can also be very useful for code quality/correctness: e.g. Language enforced purity (of functions) (in D) can be very useful for optimization (It's inferred in most compilers, but it can at least save a trip) and being able to trust (even a D function pointer) to be pure.

Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by pcvarmint on Wednesday June 28, 2017 @03:51AM (#14652405)
Fortran is better in this regard.
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by cwzwarich on Thursday June 22, 2017 @02:51PM (#14614401)
If you have a fixed size stack, then it's impossible for optimizations to not leak into the language, because stack overflow is an observable failure.
Re:What Challenges and Trade-Offs Do Optimising Compilers Face? by ACow_Adonis on Thursday June 22, 2017 @09:55PM (#14616662)
Doesn't that make the assumption that there is a hard and fast distinction between compiler and language?

That the compiler isn't fundamentally part of the language or integrated into the language itself?

I don't think that has to hold for all possible language designs...