My message was delayed for a few months in the purgatory of moderation,
so the info in the original email is somewhat out of date. I wrote a
summary of my findings in the file "capstone.pdf" here:

https://db.tt/JNcSdrIe

The moral of the story is that I got up to a 2x speedup with around 10
tasks (in Rust 0.8). There is a sequential bottleneck somewhere,
probably when it is collecting the results from the separate tasks into
a single array. I've thought of some ways it might be possible to
parallelize that, but haven't implemented it.

Simon Sapin <simon.sa...@exyr.org> wrote:
> Daniel Hackney wrote:
>>
>> I have created a library[1] for speculative parallel computing and
>> used lexing CSS as my test case. I think Servo could benefit from the
>> speedups enabled by handling large, sequential tasks in parallel and
>> wanted to make you all aware of my work. I modified rust-cssparser to
>> do only tokenization, so the results are not perfectly comparable, but
>> should be similar.
>>
>> [1] https://github.com/haxney/speculate
>>
>
> This looks very interesting!
>
> I assume the speedups are compared to single-threaded non-speculative
> lexing?

Correct. It is using the same algorithm, just without any of the
overhead of synchronization or speculation.

> If you have speculative lexing (str -> [Token]) followed by "block and
> function grouping" ([Token] -> [ComponentValue]) in order to get equivalent
> functionality to rust-cssparser, do you still get speedups compared to
> current rust-cssparser? (Which does str -> [ComponentValue])

I haven't investigated it. It would require writing a [Token] ->
[ComponentValue] function, which I didn't yet do for the academic
project. My suspicion is that the lexing takes the bulk of the time,
since CSS doesn't have a very complicated structure, but I haven't
measured it.

If you think this is something Servo might want to incorporate, I could
look into implementing the parser.

--
Daniel Hackney
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to