How to inline this function call so it behaves the same

The issue is not that bcmp is not inlined. The issue is that the inlined code is not being specialized for integer arguments. Instead, it uses the polymorphic comparison, which is costly. If you change the code to

let [@inline] bcmp (i:int) j = if i <= j then Some (i, j) else None

it should work a lot better.

1 Like