Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# compiler questions

A couple questions about the F# compiler

1) what does --noframework do? I compiled with it but I still needed .Net 4.0(I thought maybe it allowed a port to an earlier version?) Does it remove an F# dependancy?

2) What optimizations does the F# --optimize+ enable? all of them? if so, what are all of them?

3) What are the advantages/disadvantages of --tailcall? I know that x64 used to ignore .tailcall sometimes, I was curious if there were other problems or if those problems persist.

4) what is --crossoptimize and what does it do?

5) is there actually a fast sublanguage or is that something really old??

like image 975
Snark Avatar asked Dec 16 '22 15:12

Snark


1 Answers

Here is more detailed answer for question 2. F# compiler has many options for optimization, and --optimize+ enables most of them.

Reading from the compiler source code, here is the list of things --optimize+ enables. I also give you the hidden flags, in case you'd like to play with them. Of course, as it is not hidden and documented, this may change in a next release:

  • JIT optimizations (--jit-optimize)
  • local optimizations (--local-optimize), such as eliminatation of dead private bindings.
  • cross-module optimizations (--crossoptimize+)
  • allow inlining of lambda functions (--inlinethreshold:6). Big functions, whose size is greater than the given threashold, won't be inlined.
  • sets ignoreSymbolStoreSequencePoints (there's no flag for this one)
  • eliminate tuples allocated at call sites, because of uncurried functions (--detuple:1). See detuple.fs for detailed comment.
  • do TLR (--tlr:1). I don't know what it is, but there are many comments in tlr.fs
  • final simplify pass (--finalSimplify:1) applies some of the optimizations a second time (after other optimizations passes).

It looks like the --extraoptimizationloops:1 flag is not enabled by --optimize+. It does the same optimizations as the final simplify pass, but at another time. Might be useless.

For question 3, tail call optimization is very useful to prevent stack overflows (when you're doing many tail recursive calls). It makes debugging harder, so you might want to turn it off sometimes (this is the default in VS, in debug-mode).

like image 158
Laurent Avatar answered Jan 05 '23 02:01

Laurent