Logic programming with lists is one example where Mathematica is typically orders of magnitude slower than other compiled languages. The following Mathematica program uses linked lists to solve the n-queens problem:
let safe (x0, y0)(x1, y1)=
x0<>x1 && y0<>y1 && x0-y0<>x1-y1 && x0+y0<>x1+y1
let rec filter f =function|->| x::xs ->if f x then x::filter f xs else filter f xs
let rec search n nqs qs ps a =
match ps with|->if nqs=n then a+1else a
| q::ps ->
search n (nqs+1)(q::qs)(filter (safe q) ps) a
|> search n nqs qs ps
let ps n =[for i in 1..n dofor j in 1..n do
yield i, j ]
let solve n = search n 0(ps n)0
Solving the 8-queens problem takes 10.5s with Mathematica and 0.07s with F#. So F# is 150× faster than Mathematica in this case.
The Stack Overflow question Mathematica "linked lists" and performance gives a more extreme example. Naive translation of that Mathematica code into F# gives an equivalent program that runs between 4,000 and 200,000× faster than the Mathematica:
let rand =System.Random()
let xs =List.init 10000(fun _ -> rand.Next100)Array.init 100(fun _ ->
let t =System.Diagnostics.Stopwatch.StartNew()
Specifically, Mathematica takes 0.156s to 16s to perform a single iteration whereas the F# takes 42µs to 86µs.
If I really want to stay in Mathematica then I shoehorn everything I'm doing into Mathematica's handful of built-in data structures, e.g. Dispatch.