path: root/src/lib/eet/eet_lib.c
diff options
authorCedric Bail <>2013-10-28 18:28:38 +0900
committerCedric Bail <>2013-10-28 18:32:40 +0900
commit1a3c9d68d068c531cb99b5c8b0fe4514927e1f92 (patch)
tree8bcb50343d5471d770dab7f9654f89048b04f595 /src/lib/eet/eet_lib.c
parent570ce667f385c2fa3d36f0280eef6222a3e19a0b (diff)
eet: help the kernel to actually load the eet file in memory more efficiently.
When you open a theme, it is very likely that most of the data in it will be needed at some point, that's why it is a good idea to tell it in advance to the kernel so it could load them if it has some spare ressource. We can't just blindly turn EINA_FILE_WILLNEED on any file or a wrong eet file would be loaded in memory when we don't need it. So we shall keep the sequential load until we are sure that the file is correct and then explicitely tell the kernel that the rest of the data should be loaded in ram.
Diffstat (limited to 'src/lib/eet/eet_lib.c')
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index f85209aa98..7fa8ce97e9 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -1043,6 +1043,16 @@ eet_internal_read2(Eet_File *ef)
1043#endif /* ifdef HAVE_SIGNATURE */ 1043#endif /* ifdef HAVE_SIGNATURE */
1044 } 1044 }
1045 1045
1046 /* At this stage we have a valid eet file, let's tell the system we are likely to need most of its data */
1047 if (ef->readfp && ef->ed)
1048 {
1049 unsigned long int offset;
1051 offset = (unsigned char*) ef->ed->start - (unsigned char*) ef->data;
1052 eina_file_map_populate(ef->readfp, EINA_FILE_WILLNEED, ef->data,
1053 offset, ef->data_size - offset);
1054 }
1046 return ef; 1056 return ef;
1047} 1057}
1048 1058