From e9a7203145c006521bed51c3dff3e8452f85ba31 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 23 Aug 2016 11:59:37 +0900 Subject: [PATCH] efreet - save about 240-300k or so of memory used by efreet mime so efreet mime was loading a bunch of mime type info files, parsing them on startup and allocating memory to store all this mime info - globs, mimetype strings and more. all a big waste of memory as its allocated on the heap per process where its the SAME data files loaded every time. so make an efreet mime cache file and a tool to create it from mime files. mmap this file with all the hashes/strings in it so all that data is mmaped once in memory and shared between all processes and it is only paged in on demand - as actually read/needed so if your process doesnt need to know about mime stuff.. it wont touch it anyway. this saves about 240-300k or so of memory in my tests. this has not covered the mime MAGIC files which still consume memory and are on the heap. this is more complex so it will take more time to come up with a nice file format for the data that is nicely mmaped etc. @optimize --- elementary/codegen_example_generated.c | 132 ------------------------- elementary/codegen_example_generated.h | 65 ------------ 2 files changed, 197 deletions(-) delete mode 100644 elementary/codegen_example_generated.c delete mode 100644 elementary/codegen_example_generated.h diff --git a/elementary/codegen_example_generated.c b/elementary/codegen_example_generated.c deleted file mode 100644 index 8ce305eb..00000000 --- a/elementary/codegen_example_generated.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "codegen_example_generated.h" - -Evas_Object * -codegen_example_layout_add(Evas_Object *o, Elm_Theme *th, const char *edje_file) -{ - Evas_Object *l; - - if (edje_file) - elm_theme_extension_add(th, edje_file); - else - elm_theme_extension_add(th, "./codegen_example.edj"); - - l = elm_layout_add(o); - if (!l) return NULL; - - if (!elm_layout_theme_set(l, "example", "mylayout", "default")) - { - evas_object_del(l); - return NULL; - } - - return l; -} - -void -codegen_example_title_set(Evas_Object *o, const char *value) -{ - elm_layout_text_set(o, "example/title", value); -} - -const char * -codegen_example_title_get(const Evas_Object *o) -{ - return elm_layout_text_get(o, "example/title"); -} - -void -codegen_example_custom_set(Evas_Object *o, Evas_Object *value) -{ - elm_layout_content_set(o, "example/custom", value); -} - -Evas_Object * -codegen_example_custom_unset(Evas_Object *o) -{ - return elm_layout_content_unset(o, "example/custom"); -} - -Evas_Object * -codegen_example_custom_get(const Evas_Object *o) -{ - return elm_layout_content_get(o, "example/custom"); -} - -Eina_Bool -codegen_example_box_append(Evas_Object *o, Evas_Object *child) -{ - return elm_layout_box_append(o, "example/box", child); -} - -Eina_Bool -codegen_example_box_prepend(Evas_Object *o, Evas_Object *child) -{ - return elm_layout_box_prepend(o, "example/box", child); -} - -Eina_Bool -codegen_example_box_insert_before(Evas_Object *o, Evas_Object *child, const Evas_Object *reference) -{ - return elm_layout_box_insert_before(o, "example/box", child, reference); -} - -Eina_Bool -codegen_example_box_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos) -{ - return elm_layout_box_insert_at(o, "example/box", child, pos); -} - -Evas_Object * -codegen_example_box_remove(Evas_Object *o, Evas_Object *child) -{ - return elm_layout_box_remove(o, "example/box", child); -} - -Eina_Bool -codegen_example_box_remove_all(Evas_Object *o, Eina_Bool clear) -{ - return elm_layout_box_remove_all(o, "example/box", clear); -} - -Eina_Bool -codegen_example_table_pack(Evas_Object *o, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan) -{ - return elm_layout_table_pack(o, "example/table", child, col, row, colspan, rowspan); -} - -Evas_Object * -codegen_example_table_unpack(Evas_Object *o, Evas_Object *child) -{ - return elm_layout_table_unpack(o, "example/table", child); -} - -Eina_Bool -codegen_example_table_clear(Evas_Object *o, Eina_Bool clear) -{ - return elm_layout_table_clear(o, "example/table", clear); -} - -void -codegen_example_swallow_grow_emit(Evas_Object *o) -{ - elm_layout_signal_emit(o, "button,enlarge", ""); -} - -void -codegen_example_swallow_shrink_emit(Evas_Object *o) -{ - elm_layout_signal_emit(o, "button,reduce", ""); -} - -void -codegen_example_size_changed_callback_add(Evas_Object *o, Edje_Signal_Cb func, void *data) -{ - elm_layout_signal_callback_add(o, "size,changed", "", func, data); -} - -void -codegen_example_size_changed_callback_del(Evas_Object *o, Edje_Signal_Cb func) -{ - elm_layout_signal_callback_del(o, "size,changed", "", func); -} - diff --git a/elementary/codegen_example_generated.h b/elementary/codegen_example_generated.h deleted file mode 100644 index b8fbc4e9..00000000 --- a/elementary/codegen_example_generated.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _CODEGEN_EXAMPLE_GENERATED_H -#define _CODEGEN_EXAMPLE_GENERATED_H - -#include -#include -#include - -#include - -/** - * @brief Creates the layout object and set the theme - * @param o The parent - * @param th The theme to add to, or if NULL, the default theme - * @param edje_file The path to edj, if NULL it's used the path given - * to elementary_codegen - */ -Evas_Object *codegen_example_layout_add(Evas_Object *o, Elm_Theme *th, const char *edje_file); - -/** - * @brief The example title - */ -void codegen_example_title_set(Evas_Object *o, const char *value); -const char *codegen_example_title_get(const Evas_Object *o); - -/** - * @brief The swallow part - */ -void codegen_example_custom_set(Evas_Object *o, Evas_Object *value); -Evas_Object *codegen_example_custom_unset(Evas_Object *o); -Evas_Object *codegen_example_custom_get(const Evas_Object *o); - -/** - * @brief The box part - */ -Eina_Bool codegen_example_box_append(Evas_Object *o, Evas_Object *child); -Eina_Bool codegen_example_box_prepend(Evas_Object *o, Evas_Object *child); -Eina_Bool codegen_example_box_insert_before(Evas_Object *o, Evas_Object *child, const Evas_Object *reference); -Eina_Bool codegen_example_box_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos); -Evas_Object *codegen_example_box_remove(Evas_Object *o, Evas_Object *child); -Eina_Bool codegen_example_box_remove_all(Evas_Object *o, Eina_Bool clear); - -/** - * @brief The table part - */ -Eina_Bool codegen_example_table_pack(Evas_Object *o, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); -Evas_Object *codegen_example_table_unpack(Evas_Object *o, Evas_Object *child); -Eina_Bool codegen_example_table_clear(Evas_Object *o, Eina_Bool clear); - -/** - * @brief Executed when the button enlarges - */ -void codegen_example_swallow_grow_emit(Evas_Object *o); - -/** - * @brief Executed when the button reduces - */ -void codegen_example_swallow_shrink_emit(Evas_Object *o); - -/** - * @brief Emit the signal size,changed - */ -void codegen_example_size_changed_callback_add(Evas_Object *o, Edje_Signal_Cb func, void *data); -void codegen_example_size_changed_callback_del(Evas_Object *o, Edje_Signal_Cb func); - -#endif /* _CODEGEN_EXAMPLE_GENERATED_H */