On Sun, Jul 29, 2012 at 11:43 AM, Erick Tryzelaar
<erick.tryzel...@gmail.com> wrote:
> Unfortunately there are some pretty severe performance issues at the moment.
> Ragel supports two state machine styles, table-driven and goto-driven. My
> backend uses tables, but since Rust doesn't yet support global constant
> vectors, I need to malloc the state machine table on every function call. This
> results in the [ragel-based url
> parser](https://github.com/erickt/ragel/blob/rust/examples/rust/url.rl)
> being about
> 10 times slower than the equivalent table-based parser in OCaml. You can see
> the generated code [here](https://gist.github.com/3200980).

There's an open bug on vector constants:

https://github.com/mozilla/rust/issues/571

It's assigned to me (though I haven't done anything on it yet), so
feel free to bug me about it :-)

>
> The `goto` route could be promising to explore. We could simulate it using
> mutually recursive function calls. OCaml does this. But again, since Rust
> doesn't support tailcalls (and may
> [ever](https://github.com/mozilla/rust/issues/217)), we could run into a stack
> explosion. It may work well for small grammars though, and maybe LLVM could
> optimize calls into tailcalls.

This sounds like the open bug on labelled break and continue, as Patrick said:

https://github.com/mozilla/rust/issues/2216

which is currently unassigned. As per #217, we decided not to support
general tail calls, but that doesn't mean we can't support tail calls
just for the special labelled break/continue form.

Cheers,
Tim

-- 
Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt
"Debate is useless when one participant denies the full dignity of the
other." -- Eric Berndt
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to