Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_entry.c e_fm.c e_test.c Log Message: for really big files lists.. efm was being hyper-slow. i knwo why - and it's fixed :) all hail a better sorting algorithm - incriemntal insertion quick sort :) (or whatever you want to call it) and a little better "scheduling" in the code :) =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_entry.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- e_entry.c 23 Jul 2006 10:24:30 -0000 1.18 +++ e_entry.c 27 Jul 2006 19:29:16 -0000 1.19 @@ -886,6 +886,7 @@ sd->entry_object = e_editable_text_add(evas); e_editable_text_text_set(sd->entry_object, " "); evas_object_geometry_get(sd->entry_object, NULL, NULL, &w, &h); + e_editable_text_text_set(sd->entry_object, NULL); edje_extern_object_min_size_set(sd->entry_object, w, h); edje_object_part_swallow(sd->edje_object, "text_area", sd->entry_object); edje_object_size_min_calc(sd->edje_object, &w, &h); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- e_fm.c 24 Jul 2006 16:59:02 -0000 1.16 +++ e_fm.c 27 Jul 2006 19:29:16 -0000 1.17 @@ -26,7 +26,7 @@ struct { Evas_Coord w, h; - } max; + } max, pmax; struct { Evas_Coord x, y; } pos; @@ -615,21 +615,58 @@ _e_fm2_queue_process(Evas_Object *obj) { E_Fm2_Smart_Data *sd; + E_Fm2_Icon *ic, *ic2; + Evas_List *l; + int added = 0; + double t; sd = evas_object_smart_data_get(obj); if (!sd) return; + if (!sd->queue) return; +/* double tt = ecore_time_get(); */ +/* int queued = evas_list_count(sd->queue); */ /* take unsorted and insert into the icon list - reprocess regions */ + t = ecore_time_get(); + /* pre-sort the queue - this will speed up insertion sort as we can + * make some assumptions */ + sd->queue = evas_list_sort(sd->queue, evas_list_count(sd->queue), _e_fm2_cb_icon_sort); + l = sd->icons; while (sd->queue) { - E_Fm2_Icon *ic; - + ic = sd->queue->data; - sd->icons = evas_list_append(sd->icons, ic); - /* insertion sort - better than qsort for the way we are doing - * things - incrimentally scan and sort as we go */ sd->queue = evas_list_remove_list(sd->queue, sd->queue); - } - sd->icons = evas_list_sort(sd->icons, evas_list_count(sd->icons), _e_fm2_cb_icon_sort); + /* insertion sort - better than qsort for the way we are doing + * things - incrimentally scan and sort as we go as we now know + * that the queue files are in order, we speed up insertions to + * a worst case of O(n) where n is the # of files in the list + * so far + */ + for (; l; l = l->next) + { + ic2 = l->data; + if (_e_fm2_cb_icon_sort(ic, ic2) < 0) + { + sd->icons = evas_list_prepend_relative_list(sd->icons, ic, l); + break; + } + } + if (!l) + sd->icons = evas_list_append(sd->icons, ic); + added++; + /* every 5 additions - check to see if we have spent too long adding */ + if ((added % 5) == 0) + { + /* if we spent more than 1/10th of a second inserting - give up + * for now */ + if ((ecore_time_get() - t) > 0.05) break; + } + } +/* printf("FM: SORT %1.3f (%i files) (%i queued, %i added)\n", + ecore_time_get() - tt, evas_list_count(sd->icons), queued, added); + */ + /* FIXME: this could get a lot faster - avoid it or something. scan + speed goes from 200-250 files/sec to 80 or so in my tests */ if (sd->resize_job) ecore_job_del(sd->resize_job); sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); evas_object_smart_callback_call(sd->obj, "files_changed", NULL); @@ -1264,7 +1301,8 @@ e_thumb_icon_file_set(ic->obj_icon, buf, NULL); e_thumb_icon_size_set(ic->obj_icon, 64, 64); evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); - if (_e_fm2_icon_visible(ic)) e_thumb_icon_begin(ic->obj_icon); + if ((_e_fm2_icon_visible(ic)) && (!ic->sd->scan_idler)) + e_thumb_icon_begin(ic->obj_icon); edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon); evas_object_show(ic->obj_icon); } @@ -1277,7 +1315,8 @@ e_thumb_icon_file_set(ic->obj_icon, buf, "desktop/background"); e_thumb_icon_size_set(ic->obj_icon, 64, 64); evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); - if (_e_fm2_icon_visible(ic)) e_thumb_icon_begin(ic->obj_icon); + if ((_e_fm2_icon_visible(ic)) && (!ic->sd->scan_idler)) + e_thumb_icon_begin(ic->obj_icon); edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon); evas_object_show(ic->obj_icon); } @@ -1290,7 +1329,8 @@ e_thumb_icon_file_set(ic->obj_icon, buf, "icon"); e_thumb_icon_size_set(ic->obj_icon, 64, 64); evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); - if (_e_fm2_icon_visible(ic)) e_thumb_icon_begin(ic->obj_icon); + if ((_e_fm2_icon_visible(ic)) && (!ic->sd->scan_idler)) + e_thumb_icon_begin(ic->obj_icon); edje_object_part_swallow(ic->obj, "icon_swallow", ic->obj_icon); evas_object_show(ic->obj_icon); } @@ -1816,7 +1856,7 @@ sd = evas_object_smart_data_get(data); if (!sd) return 0; _e_fm2_queue_process(data); - if (!sd->scan_idler) + if ((!sd->queue) && (!sd->scan_idler)) { sd->scan_timer = NULL; return 0; @@ -1848,7 +1888,7 @@ sd->x + ic->x - sd->pos.x, sd->y + ic->y - sd->pos.y); evas_object_resize(ic->obj, ic->w, ic->h); - if (_e_fm2_icon_visible(ic)) + if ((_e_fm2_icon_visible(ic)) && (!ic->sd->scan_idler)) e_thumb_icon_begin(ic->obj_icon); else e_thumb_icon_end(ic->obj_icon); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_test.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -3 -r1.58 -r1.59 --- e_test.c 23 Jul 2006 11:22:13 -0000 1.58 +++ e_test.c 27 Jul 2006 19:29:16 -0000 1.59 @@ -778,7 +778,7 @@ dia = e_dialog_new(con); e_dialog_title_set(dia, "A Test Dialog"); - o = e_widget_fsel_add(dia->win->evas, "~/", "/", NULL, NULL, + o = e_widget_fsel_add(dia->win->evas, "~/", "/tst", NULL, NULL, _e_test_cb_selected, dia, _e_test_cb_changed, dia); evas_object_show(o); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs