Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize clipper: SIMD, reuse allocations, use slices #5

Merged
merged 5 commits into from Oct 9, 2015

Conversation

@Manishearth
Copy link
Member

Manishearth commented Oct 3, 2015

More to come, possibly

r? @glennw

@Manishearth Manishearth force-pushed the Manishearth:opt branch from 3f95c53 to c40e1b0 Oct 3, 2015
@Manishearth
Copy link
Member Author

Manishearth commented Oct 3, 2015

Not really sure if that second commit helps anything

@Manishearth Manishearth force-pushed the Manishearth:opt branch from c40e1b0 to 0b3530e Oct 3, 2015
@Manishearth
Copy link
Member Author

Manishearth commented Oct 3, 2015

Added some benchmarks based on real world data. rectangles.dat contains rectangle clipping data from various sites (500-1000 each), polygons.in contains all the polygon clipping data for the same.

Before:

running 2 tests
test bench_clip_poly ... bench:     116,924 ns/iter (+/- 2,995)
test bench_clip_rect ... bench:      78,551 ns/iter (+/- 1,992)

After:

test bench_clip_poly ... bench:     109,496 ns/iter (+/- 7,831)
test bench_clip_rect ... bench:      62,761 ns/iter (+/- 18,283)

The poly test has large variance, but multiple runs confirm an improvement.

@Manishearth Manishearth force-pushed the Manishearth:opt branch 2 times, most recently from 73d3b47 to 056d9e7 Oct 3, 2015
@Manishearth
Copy link
Member Author

Manishearth commented Oct 3, 2015

With the shared clip buffers:

test bench_clip_poly ... bench:      99,667 ns/iter (+/- 6,136)

We still do some cloning. I think we can reduce some of that with some magic.

@Manishearth Manishearth force-pushed the Manishearth:opt branch from 056d9e7 to bb0bd58 Oct 3, 2015
@Manishearth
Copy link
Member Author

Manishearth commented Oct 3, 2015

With the shared result buffer:

test bench_clip_poly ... bench:      94,444 ns/iter (+/- 5,819)
@Manishearth
Copy link
Member Author

Manishearth commented Oct 3, 2015

We should probably do some manual profiling of each step before merging. I'm not sure if all of these really end up optimizing it in actual usage. The numbers from testing on Servo looked promising, but they varied a lot.

@Manishearth Manishearth changed the title Optimize clipper: SIMD, reuse allocations Optimize clipper: SIMD, reuse allocations, use slices Oct 3, 2015
@Manishearth Manishearth force-pushed the Manishearth:opt branch from a23f60b to d3be8a6 Oct 9, 2015
@glennw
Copy link
Member

glennw commented Oct 9, 2015

Thanks!

glennw added a commit that referenced this pull request Oct 9, 2015
Optimize clipper: SIMD, reuse allocations, use slices
@glennw glennw merged commit d84824b into servo:master Oct 9, 2015
@Manishearth Manishearth deleted the Manishearth:opt branch Oct 9, 2015
@Manishearth
Copy link
Member Author

Manishearth commented Oct 9, 2015

Final numbers post rebase:

test bench_clip_poly ... bench:      88,945 ns/iter (+/- 11,819)
test bench_clip_rect ... bench:      57,166 ns/iter (+/- 3,722)

... I don't know how that happened. Perhaps SIMD got faster (more platform-specific specialization?), or one of our other crates. shrug

nox pushed a commit to nox/webrender that referenced this pull request Aug 6, 2016
kvark pushed a commit to kvark/webrender that referenced this pull request Oct 31, 2016
Added mask image and border corner tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.