Page MenuHomePhabricator

evas_textblock: allocator use same heap if it is large enough
ClosedPublic

Authored by ali.alzyod on Aug 28 2019, 7:23 AM.

Details

Summary

allocator use same heap if it is large enough

I am also think to move this struct/functionality into common place, I think we can use it in other parts too

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ali.alzyod created this revision.Aug 28 2019, 7:23 AM

It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added: https://phab.enlightenment.org/w/maintainers_reviewers/

ali.alzyod requested review of this revision.Aug 28 2019, 7:23 AM
ali.alzyod retitled this revision from evas_textblock: allocator use same heap if it is large to evas_textblock: allocator use same heap if it is large enough.Aug 28 2019, 7:24 AM
ali.alzyod edited the summary of this revision. (Show Details)
ali.alzyod added reviewers: smohanty, Hermet, bowonryu.
smohanty added inline comments.Aug 28 2019, 12:24 PM
src/lib/evas/canvas/evas_object_textblock.c
3123

the whole idea of _allocator_reset() called inside the while loop is to reuse the stack buffer often so that we don't fallback to heap memory. by moving it out of while loop defeats the whole purpose of stack buffer allocator.

So your patch will not gain anything extra. If your profile data shows we fallback to heap more often then best way to avoid is to increase the default stack buffer size.

smohanty requested changes to this revision.Aug 28 2019, 12:27 PM

I think you are optimising wrong place . Please put some log and run elementary_test and first see how many heap allocation is happening and whats the average size of those strings , then you will get a better understanding about the nature of the problem and how to fix it.

This revision now requires changes to proceed.Aug 28 2019, 12:27 PM
ali.alzyod added inline comments.Aug 28 2019, 9:16 PM
src/lib/evas/canvas/evas_object_textblock.c
3123

1 - I do not see how _allocator_reset is related to reuse stack buffer !!

2 - each time we call _allocator_make_string it will try to use stack buffer even if you did not call _allocator_reset.

3 - reuse heap will reduce number of allocation .

smohanty added inline comments.Aug 28 2019, 9:28 PM
src/lib/evas/canvas/evas_object_textblock.c
3123

my bad .. I overlooked that we are not incrementing the stack top.

smohanty accepted this revision.Aug 28 2019, 9:28 PM
This revision is now accepted and ready to land.Aug 28 2019, 9:28 PM
SanghyeonLee accepted this revision.Aug 29 2019, 2:44 AM
This revision was automatically updated to reflect the committed changes.