From 9ff2f03c35f46461eb654a6a85483ac0d587d871 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 20 Mar 2020 15:14:58 +0100 Subject: [PATCH] eo-files: reorder some functions this started earlier today in IRC, the idea was that now, that we are having a denser memory layout in the vtables, we could simply reorder the functions in the .eo files into groups that are often called next to each other, that rises the chance that the Vtable nodes as well as the chains are still in the cache. After searching a bit for these groups, the below changed .eo files came up. When a object is constructed, we call a lot parent set constructor finalizer and provider find stuff. So moving these together seems logical. During rendering we also call a lot of gfx hints, which is also paying off, our cache miss number goes down quite a bit. cache misses averages: (Messured on a Dell XPS i7-7700HQ) without this: 8945471 with this: 8014886 Differential Revision: https://phab.enlightenment.org/D11548 --- src/lib/efl/interfaces/efl_gfx_hint.eo | 182 ++++++++++----------- src/lib/eo/efl_object.eo | 214 ++++++++++++------------- 2 files changed, 198 insertions(+), 198 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_hint.eo b/src/lib/efl/interfaces/efl_gfx_hint.eo index d60ee1b297..2394c11f78 100644 --- a/src/lib/efl/interfaces/efl_gfx_hint.eo +++ b/src/lib/efl/interfaces/efl_gfx_hint.eo @@ -23,6 +23,97 @@ interface Efl.Gfx.Hint ]] event_c_prefix: efl_gfx_entity; methods { + @property hint_size_max { + [[Hints on the object's maximum size. + + This is not a size enforcement in any way, it's just a hint + that should be used whenever appropriate. + + The object container is in charge of fetching this property and + placing the object accordingly. + + Values -1 will be treated as unset hint components, when + queried by managers. + + Note: Smart objects (such as elementary) can have their own + hint policy. So calling this API may or may not affect + the size of smart objects. + + Note: It is an error for the @.hint_size_max to be smaller in either axis + than @.hint_size_min. In this scenario, the max size hint will be + prioritized over the user min size hint. + ]] + values { + sz: Eina.Size2D; [[Maximum size (hint) in pixels, (-1, -1) by + default for canvas objects).]] + } + } + @property hint_margin { + [[Hints for an object's margin or padding space. + + This is not a size enforcement in any way, it's just a hint + that should be used whenever appropriate. + + The object container is in charge of fetching this property and + placing the object accordingly. + + Note: Smart objects (such as elementary) can have their own + hint policy. So calling this API may or may not affect + the size of smart objects. + ]] + /* + @image html padding-hints.png + */ + values { + l: int; [[Integer to specify left padding.]] + r: int; [[Integer to specify right padding.]] + t: int; [[Integer to specify top padding.]] + b: int; [[Integer to specify bottom padding.]] + } + } + @property hint_align { + [[Hints for an object's alignment. + + These are hints on how to align this object inside the + boundaries of its container/manager. + + This is not a size enforcement in any way, it's just a hint + that should be used whenever appropriate. + ]] + /* + @image html alignment-hints.png + */ + values { + x: Efl.Gfx.Align(0.5); [[Controls the horizontal alignment.]] + y: Efl.Gfx.Align(0.5); [[Controls the vertical alignment.]] + } + } + @property hint_weight { + [[Hints for an object's weight. + + This is a hint on how a container object should resize a given + child within its area. Containers may adhere to the simpler + logic of just expanding the child object's dimensions to fit + its own (see the @Efl.Gfx.Hint_Expand helper weight macro) or + the complete one of taking each child's weight hint as real + weights to how much of its size to allocate for them in each + axis. A container is supposed to, after normalizing the + weights of its children (with weight hints), distribut + the space it has to layout them by those factors -- most + weighted children get larger in this process than the least + ones. + + Accepted values are zero or positive values. Some containers might + use this hint as a boolean, but some others might consider it as a + proportion, see documentation of each container. + + Note: Default weight hint values are 0.0, for both axis. + ]] + values { + x: double; [[Non-negative double value to use as horizontal weight hint.]] + y: double; [[Non-negative double value to use as vertical weight hint.]] + } + } @property hint_aspect { [[Defines the aspect ratio to respect when scaling this object. @@ -50,31 +141,6 @@ interface Efl.Gfx.Hint */ } } - @property hint_size_max { - [[Hints on the object's maximum size. - - This is not a size enforcement in any way, it's just a hint - that should be used whenever appropriate. - - The object container is in charge of fetching this property and - placing the object accordingly. - - Values -1 will be treated as unset hint components, when - queried by managers. - - Note: Smart objects (such as elementary) can have their own - hint policy. So calling this API may or may not affect - the size of smart objects. - - Note: It is an error for the @.hint_size_max to be smaller in either axis - than @.hint_size_min. In this scenario, the max size hint will be - prioritized over the user min size hint. - ]] - values { - sz: Eina.Size2D; [[Maximum size (hint) in pixels, (-1, -1) by - default for canvas objects).]] - } - } @property hint_size_restricted_max { [[Internal hints for an object's maximum size. @@ -187,72 +253,6 @@ interface Efl.Gfx.Hint sz: Eina.Size2D; [[Minimum size (hint) in pixels.]] } } - @property hint_margin { - [[Hints for an object's margin or padding space. - - This is not a size enforcement in any way, it's just a hint - that should be used whenever appropriate. - - The object container is in charge of fetching this property and - placing the object accordingly. - - Note: Smart objects (such as elementary) can have their own - hint policy. So calling this API may or may not affect - the size of smart objects. - ]] - /* - @image html padding-hints.png - */ - values { - l: int; [[Integer to specify left padding.]] - r: int; [[Integer to specify right padding.]] - t: int; [[Integer to specify top padding.]] - b: int; [[Integer to specify bottom padding.]] - } - } - @property hint_weight { - [[Hints for an object's weight. - - This is a hint on how a container object should resize a given - child within its area. Containers may adhere to the simpler - logic of just expanding the child object's dimensions to fit - its own (see the @Efl.Gfx.Hint_Expand helper weight macro) or - the complete one of taking each child's weight hint as real - weights to how much of its size to allocate for them in each - axis. A container is supposed to, after normalizing the - weights of its children (with weight hints), distribut - the space it has to layout them by those factors -- most - weighted children get larger in this process than the least - ones. - - Accepted values are zero or positive values. Some containers might - use this hint as a boolean, but some others might consider it as a - proportion, see documentation of each container. - - Note: Default weight hint values are 1.0, for both axis. - ]] - values { - x: double; [[Non-negative double value to use as horizontal weight hint.]] - y: double; [[Non-negative double value to use as vertical weight hint.]] - } - } - @property hint_align { - [[Hints for an object's alignment. - - These are hints on how to align this object inside the - boundaries of its container/manager. - - This is not a size enforcement in any way, it's just a hint - that should be used whenever appropriate. - ]] - /* - @image html alignment-hints.png - */ - values { - x: Efl.Gfx.Align(0.5); [[Controls the horizontal alignment.]] - y: Efl.Gfx.Align(0.5); [[Controls the vertical alignment.]] - } - } @property hint_fill { [[Hints for an object's fill property that used to specify "justify" or "fill" by some users. @.hint_fill specify whether to fill diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo index b336a4ee65..26181240b7 100644 --- a/src/lib/eo/efl_object.eo +++ b/src/lib/eo/efl_object.eo @@ -75,6 +75,50 @@ abstract Efl.Object c_prefix: efl; methods { + constructor { + [[Implement this method to provide optional initialization code for your object. + + See the Life Cycle section in this class' description.]] + return: Efl.Object; [[The new object, can be $NULL if aborted.]] + } + destructor { + [[Implement this method to provide deinitialization code for your object if you need it. + + Will be called once @.invalidate has returned. + See the Life Cycle section in this class' description.]] + } + finalize { + [[Implement this method to finish the initialization of your object + after all (if any) user-provided configuration methods have been + executed. + + Use this method to delay expensive operations until user configuration + has finished, to avoid building the object in a "default" state in the + constructor, just to have to throw it all away because a user + configuration (a property being set, for example) requires a different + state. + This is the last call inside efl_add() and will set @.finalized to $true + once it returns. + This is an optimization and implementing this method is optional if you + already perform all your initialization in the @.constructor method. + See the Life Cycle section in this class' description.]] + return: Efl.Object; [[The new object. Return $NULL to abort object creation.]] + } + invalidate { + [[Implement this method to perform special actions when your object loses + its parent, if you need to. + + It is called when the parent reference is lost or set to $NULL. After this + call returns, @.invalidated is set to $true. + This allows a simpler tear down of complex hierarchies, by performing + object destruction in two steps, first all object relationships are + broken and then the isolated objects are destroyed. Performing everything + in the @.destructor can sometimes lead to deadlocks, but implementing + this method is optional if this is not your case. + When an object with a parent is destroyed, it first receives a call to + @.invalidate and then to @.destructor. + See the Life Cycle section in this class' description.]] + } @property parent { [[The parent of an object. @@ -103,55 +147,6 @@ abstract Efl.Object parent: Efl.Object; [[The new parent.]] } } - @property name { - [[The name of the object. - - Every EFL object can have a name. Names may not contain the - following characters: / ? * [ ] ! \ : - Using any of these in a name will result in undefined behavior - later on. An empty string is considered the same as a $NULL string - or no string for the name. - ]] - set { - } - get { - } - values { - name: string; [[The name.]] - } - } - @property comment { - [[A human readable comment for the object. - - Every EFL object can have a comment. This is intended for developers - and debugging. An empty string is considered the same as a $NULL - string or no string for the comment. - ]] - set { - } - get { - } - values { - comment: string; [[The comment.]] - } - } - debug_name_override { - [[Build a read-only name for this object used for debugging. - - Multiple calls using efl_super() can be chained in order to build - the entire debug name, from parent to child classes. In C the usual - way to build the string is as follows: - - efl_debug_name_override(efl_super(obj, MY_CLASS), sb); - eina_strbuf_append_printf(sb, "new_information"); - - Usually more debug information should be added to $sb after - calling the super function. - ]] - params { - @in sb: strbuf; [[A string buffer, must not be $null.]] - } - } @property event_global_freeze_count @static { [[Return the global count of freeze events. @@ -224,64 +219,6 @@ abstract Efl.Object } return : Efl.Object; [[Object from the provider list.]] } - constructor { - [[Implement this method to provide optional initialization code for your object. - - See the Life Cycle section in this class' description.]] - return: Efl.Object; [[The new object, can be $NULL if aborted.]] - } - destructor { - [[Implement this method to provide deinitialization code for your object if you need it. - - Will be called once @.invalidate has returned. - See the Life Cycle section in this class' description.]] - } - finalize { - [[Implement this method to finish the initialization of your object - after all (if any) user-provided configuration methods have been - executed. - - Use this method to delay expensive operations until user configuration - has finished, to avoid building the object in a "default" state in the - constructor, just to have to throw it all away because a user - configuration (a property being set, for example) requires a different - state. - This is the last call inside efl_add() and will set @.finalized to $true - once it returns. - This is an optimization and implementing this method is optional if you - already perform all your initialization in the @.constructor method. - See the Life Cycle section in this class' description.]] - return: Efl.Object; [[The new object. Return $NULL to abort object creation.]] - } - invalidate { - [[Implement this method to perform special actions when your object loses - its parent, if you need to. - - It is called when the parent reference is lost or set to $NULL. After this - call returns, @.invalidated is set to $true. - This allows a simpler tear down of complex hierarchies, by performing - object destruction in two steps, first all object relationships are - broken and then the isolated objects are destroyed. Performing everything - in the @.destructor can sometimes lead to deadlocks, but implementing - this method is optional if this is not your case. - When an object with a parent is destroyed, it first receives a call to - @.invalidate and then to @.destructor. - See the Life Cycle section in this class' description.]] - } - name_find @const @beta { - [[Find a child object with the given name and return it. - - The search string can be a glob (shell style, using *). It can also - specify class name in the format of "class:name" where ":" - separates class and name. Both class and name can be globs. - If the class is specified but the name is empty like "class:" then - the search will match any object of that class. - ]] - params { - @in search: string; [[The name search string.]] - } - return: Efl.Object; [[The first object found.]] - } event_thaw { [[Thaw events of object. @@ -355,6 +292,20 @@ abstract Efl.Object @in new_obj: Efl.Object; [[The object to emit events from]] } } + name_find @const @beta { + [[Find a child object with the given name and return it. + + The search string can be a glob (shell style, using *). It can also + specify class name in the format of "class:name" where ":" + separates class and name. Both class and name can be globs. + If the class is specified but the name is empty like "class:" then + the search will match any object of that class. + ]] + params { + @in search: string; [[The name search string.]] + } + return: Efl.Object; [[The first object found.]] + } children_iterator_new { [[Get an iterator on all children.]] return: iterator @move @no_unused; [[Children iterator]] @@ -429,6 +380,55 @@ abstract Efl.Object } return: bool; [[$true if successfully unregistered, $false otherwise.]] } + @property name { + [[The name of the object. + + Every EFL object can have a name. Names may not contain the + following characters: / ? * [ ] ! \ : + Using any of these in a name will result in undefined behavior + later on. An empty string is considered the same as a $NULL string + or no string for the name. + ]] + set { + } + get { + } + values { + name: string; [[The name.]] + } + } + @property comment { + [[A human readable comment for the object. + + Every EFL object can have a comment. This is intended for developers + and debugging. An empty string is considered the same as a $NULL + string or no string for the comment. + ]] + set { + } + get { + } + values { + comment: string; [[The comment.]] + } + } + debug_name_override { + [[Build a read-only name for this object used for debugging. + + Multiple calls using efl_super() can be chained in order to build + the entire debug name, from parent to child classes. In C the usual + way to build the string is as follows: + + efl_debug_name_override(efl_super(obj, MY_CLASS), sb); + eina_strbuf_append_printf(sb, "new_information"); + + Usually more debug information should be added to $sb after + calling the super function. + ]] + params { + @in sb: strbuf; [[A string buffer, must not be $null.]] + } + } } implements { class.constructor;