-
Notifications
You must be signed in to change notification settings - Fork 473
Closed
Labels
Description
OCaml's pattern match compiler generates very efficient code, however, it is not tweaked for code size,
see such example:
let f x =
let y = match x with a0::a1::a2::a3::a4::a5::a6::_ -> a0+a1+a2+a3+a4+a5+a6 | _ -> 0 in y + 2 ;;The common pattern is that for each pattern, we generate lots of temporay let match/id =a xx in if match/id
if we lift the definition to the toplevel.
var match/id
if (match/id = xx) Then we can simplify further
var match/id0, match/id1
if(match/id0 = xx0 && match/id1 = xx1){
..
} else {
...
}