Skip to main content

Questions tagged [optimization]

Use this tag for questions about efficient compilation or execution of a programming language, including in a virtual machine, or language features that facilitate more efficient code generation or execution for interpreters

5 votes
0 answers
152 views

Some operations are distributive over each other. (addition/multiplication, and/or, etc) That property can be used to optimize code with factoring. However, optimal factoring can be quite slow in the ...
ggZQX6YPvD's user avatar
13 votes
6 answers
8k views

Why do optimizing compilers never offer backends in the source language itself? Isn't targeting the source language much easier than targeting assembly? Also, couldn't a source-to-source optimizer ...
ggZQX6YPvD's user avatar
8 votes
0 answers
162 views

In the C++ memory model through C++23, one of the memory ordering types for loads is memory_order_consume. The intent of this was to expose the feature that most ...
Nate Eldredge's user avatar
6 votes
1 answer
268 views

In Simple and Effective Type Check Removal through Lazy Basic Block Versioning, which introduces Lazy Basic Block Versioning (LBBV), they have runtime type checks expand into two thunks for the cases ...
chc4's user avatar
  • 257
6 votes
0 answers
331 views

(While I'm referring to JS in my example, I don't intend to be constrained to JS: so any comments/answers concerning FP-style APIs for working with collections for any language are welcome and ...
Dai's user avatar
  • 161
6 votes
3 answers
626 views

What design restrictions inform a language having / having a useful whole-program optimizing compiler? I'm aware that Standard ML has a whole-program optimizing compiler implementation in MLton. I ...
apropos's user avatar
  • 1,295
50 votes
5 answers
18k views

This answer is an example of a compiler recognizing that a complex expression is equivalent to a single operation: ...
CPlus's user avatar
  • 10.5k
0 votes
4 answers
712 views

Can I design or implement a programming language (doesn't have to be general purpose) such that "suboptimal" code in the language will become optimal after compilation? E.g., guaranteeing ...
user avatar
5 votes
1 answer
728 views

I am familiar with traditional linking concepts (static and dynamic linking, relocation, PIE) and with traditional compiler optimizations (such as static expression evaluation, loop unrolling and ...
Borisav Živanović's user avatar
3 votes
6 answers
644 views

In a scope that defines two variables a and b, the code firstly does things only on a. Then <...
user23013's user avatar
  • 3,314
12 votes
0 answers
325 views

Consider for a motivating example a copy-on-write array, which implements a persistent (i.e. immutable) array data type. As an optimisation at runtime, a reference counter can be used to avoid the ...
kaya3's user avatar
  • 22.4k
0 votes
1 answer
214 views

I am implementing a WASM backend and I hope to optimize the size. I have collected a series of static data. After erasing the type, it can be simply considered as ...
Aster's user avatar
  • 3,508
3 votes
1 answer
610 views

I want to promote all variables within the function to the top level of the function, make it more cache-friendly and reduce size bloat caused by alignment fill. In other words, it will roughly ...
Aster's user avatar
  • 3,508
3 votes
2 answers
692 views

Many programming languages, including C89, specify that the behavior of a program in terms of sequentially executed steps, whose behavior is in turn defined in terms of the program's state when the ...
supercat's user avatar
  • 2,330

15 30 50 per page