Page MenuHomePhabricator

ector_software_rasterizer: Remove alloca function.
AbandonedPublic

Authored by jsuya on May 8 2019, 1:03 AM.

Details

Reviewers
Hermet
kimcinoo
Summary

The larger the image size, the larger the memory allocated to alloca.
As far as I know, using alloca in a loop and
allocating a relatively large amount is not a good idea.

Test Plan

N/A

Diff Detail

Repository
rEFL core/efl
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11317
Build 8610: arc lint + arc unit
jsuya created this revision.May 8 2019, 1:03 AM
jsuya requested review of this revision.May 8 2019, 1:03 AM
Hermet requested changes to this revision.May 8 2019, 1:28 AM

Please move the alloca() outside of the loop,
You don't need to use BLEND_MASK_BUFFER_SIZE all cases.

This revision now requires changes to proceed.May 8 2019, 1:28 AM

Why is using alloca worse than allocating a FIXED SIZE buffer of 2K on the stack?
If you want to limit the maximum buffer size you can do it, and still use alloca, no?

Hermet added inline comments.May 8 2019, 1:36 AM
src/lib/ector/software/ector_software_rasterizer.c
82

if spans->len is bigger than BLEND_MASK_BUFFER_SIZE, it will be crashed by invalid memory access. :(

Hermet added a comment.May 8 2019, 1:38 AM

Why is using alloca worse than allocating a FIXED SIZE buffer of 2K on the stack?
If you want to limit the maximum buffer size you can do it, and still use alloca, no?

This is totally wrong patch, there is no any benefits, even this logic possibly occur crashes.

jsuya abandoned this revision.May 9 2019, 12:19 AM

It is wrong that BUFFER_SIZE is 2k. I think it's fine if it's a small buffer as appropriate.
Probably 1~255. or half of width.
The crash problem is solved by a little bit more change.
But I will abandon this revision.

I think it is more efficient to reuse small buffer(avoid duplication)
than to do allocation memory every time.
But as you say, this change seems to be ineffective.