3 ms·
> Optimizing that code is not so easy, especially if that involves inlining C code (I wouldn't try, if possible) Inlining through C code probably isn't really
by masklinn 10y ago
> Optimizing that code is not so easy, especially if that involves inlining C code (I wouldn't try, if possible)
Inlining through C code probably isn't really an option[0], but the optimisation itself shouldn't be that much of an issue, the rust version and the equivalent imperative loop compile to the exact same code: https://godbolt.org/g/OJHIwc[1] https://godbolt.org/g/OJHIwc[1]
[0] unless you interpret — and can JIT — the C code with the same underlying machinery as Truffle does
[1] used iter_arith for sum(), but you can replace sum() by an explicit fold for no difference: https://godbolt.org/g/R1BgQQ https://godbolt.org/g/R1BgQQ
- gsnedders 10y ago> [0] unless you interpret — and can JIT — the C code with the same underlying machinery as Truffle does Pyston can easily JIT the C code because it uses LLVM for it's main JIT tier.