Thanks for the nice patch! > datetime: Refactor to launch test_datetime little bit faster
But the commit message should be changed to something like: > datetime: Enhance datetime launching time by reducing redundant calculation. Anyhow, datetime launching time is reduced but it is still slow... hmm. Need to analyze it more. Thanks. Daniel Juyung Seo (SeoZ) On Mon, Feb 3, 2014 at 9:13 AM, Ryuan Choi <ryuan.c...@gmail.com> wrote: > ryuan pushed a commit to branch master. > > > http://git.enlightenment.org/core/elementary.git/commit/?id=5cb9d937e6d5f73bd8dba00fdddbc830ab4192af > > commit 5cb9d937e6d5f73bd8dba00fdddbc830ab4192af > Author: Ryuan Choi <ryuan.c...@gmail.com> > Date: Mon Feb 3 09:03:26 2014 +0900 > > datetime: Refactor to launch test_datetime little bit faster > > - Added enabled_filed_count to avoid loop in > _elm_datetime_smart_sizing_eval(). > sizing_eval is called many times but field_count is only changed > when called > _reload_format(). > - Moved redundant if statement out of the loop in > _field_list_display(). > - Removed redundant call from _elm_datetime_smart_add(). > _field_list_arrange() is called in _reload_format(). > --- > src/lib/elm_datetime.c | 29 ++++++++++++++--------------- > src/lib/elm_widget_datetime.h | 1 + > 2 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c > index bb5ede9..5553b30 100644 > --- a/src/lib/elm_datetime.c > +++ b/src/lib/elm_datetime.c > @@ -103,14 +103,13 @@ _field_list_display(Evas_Object *obj) > > ELM_DATETIME_DATA_GET(obj, sd); > > + if (!dt_mod || !dt_mod->field_value_display) return; > + > for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) > { > field = sd->field_list + idx; > if (field->fmt_exist && field->visible) > - { > - if ((dt_mod) && (dt_mod->field_value_display)) > - dt_mod->field_value_display(sd->mod_data, field->item_obj); > - } > + dt_mod->field_value_display(sd->mod_data, field->item_obj); > } > } > > @@ -326,6 +325,7 @@ _reload_format(Evas_Object *obj) > _expand_format(dt_fmt); > > // reset all the fields to disable state > + sd->enabled_field_count = 0; > for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) > { > field = sd->field_list + idx; > @@ -336,6 +336,13 @@ _reload_format(Evas_Object *obj) > field_count = _parse_format(obj, dt_fmt); > free(dt_fmt); > > + for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) > + { > + field = sd->field_list + idx; > + if (field->fmt_exist && field->visible) > + sd->enabled_field_count++; > + } > + > // assign locations to disabled fields for uniform usage > for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) > { > @@ -495,20 +502,14 @@ _elm_datetime_smart_disable(Eo *obj, void *_pd, > va_list *list) > static void > _elm_datetime_smart_sizing_eval(Eo *obj, void *_pd, va_list *list > EINA_UNUSED) > { > - Datetime_Field *field; > Evas_Coord minw = -1, minh = -1; > - unsigned int idx, field_count = 0; > > Elm_Datetime_Smart_Data *sd = _pd; > ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); > > - for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) > - { > - field = sd->field_list + idx; > - if ((field->visible) && (field->fmt_exist)) field_count++; > - } > - if (field_count) > - elm_coords_finger_size_adjust(field_count, &minw, 1, &minh); > + if (sd->enabled_field_count) > + elm_coords_finger_size_adjust(sd->enabled_field_count, &minw, 1, > &minh); > + > edje_object_size_min_restricted_calc > (wd->resize_obj, &minw, &minh, minw, minh); > evas_object_size_hint_min_set(obj, minw, minh); > @@ -836,8 +837,6 @@ _elm_datetime_smart_add(Eo *obj, void *_pd, va_list > *list EINA_UNUSED) > _field_list_init(obj); > _reload_format(obj); > > - _field_list_arrange(obj); > - > elm_widget_can_focus_set(obj, EINA_TRUE); > > elm_layout_sizing_eval(obj); > diff --git a/src/lib/elm_widget_datetime.h b/src/lib/elm_widget_datetime.h > index f49b790..58e25ff 100644 > --- a/src/lib/elm_widget_datetime.h > +++ b/src/lib/elm_widget_datetime.h > @@ -61,6 +61,7 @@ struct _Elm_Datetime_Smart_Data > Elm_Datetime_Module_Data *mod_data; > char format[ELM_DATETIME_MAX_FORMAT_LEN]; > Evas_Object *access_obj; > + int enabled_field_count; > Eina_Bool user_format : 1; /* whether user set > * format or default > * format. */ > > -- > > > ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel