Le 08/02/2013 18:41, Simon Sapin a écrit :
Hi dev-servo,
For context, see other threads about my new CSS parser.
Servo is made to "parallel all the things", right?
Some algorithms are very hard to parallelize. Parsers would be a very
good example, because they often look like "read a bit, change the
state, read a bit, change the state" and how what is read is interpreted
depends on the current state.
In a CSS parser, the tokenizer and maybe the decoder (from bytes to
Unicode) could each be in their own task, running in parallel with the
parser. Then each rule or declaration (in their generic form described
by css3-syntax) could be parsed further in its own task.
But maybe that’s not desirable. Maybe such a parser would spend more
time sending tiny messages between tons of tasks than doing actual
work. I have no idea.
And it's not an easy question to answer. The best is try different
things, measure and compare. If I understand Rust well enough, the best
strategy would be to exchange unique pointers between tasks, so that's
usually cheap by comparison with the size of the message being sent.
What is the desired level of parallelism?
I would have the same answer than Brian; whatever is the fastest.
Parallelism isn't an end in itself. If you create a thousand tasks, you
may end up doing something slower than if you have 2 tasks.
There has been a recent post on es-discuss about a idea for a parser
[1]. Maybe this idea could be better applied to CSS because it has a
relatively easier grammar.
David
[1] https://mail.mozilla.org/pipermail/es-discuss/2013-January/028162.html
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo