cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1a3c9d68d068c531cb99b5c8b0fe4514927e1f92

commit 1a3c9d68d068c531cb99b5c8b0fe4514927e1f92
Author: Cedric Bail <[email protected]>
Date:   Mon Oct 28 18:28:38 2013 +0900

    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.
---
 src/lib/eet/eet_lib.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index f85209a..7fa8ce9 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)
 #endif /* ifdef HAVE_SIGNATURE */
      }
 
+   /* At this stage we have a valid eet file, let's tell the system we are 
likely to need most of its data */
+   if (ef->readfp && ef->ed)
+     {
+        unsigned long int offset;
+
+        offset = (unsigned char*) ef->ed->start - (unsigned char*) ef->data;
+        eina_file_map_populate(ef->readfp, EINA_FILE_WILLNEED, ef->data,
+                               offset, ef->data_size - offset);
+     }
+
    return ef;
 }
 

-- 


Reply via email to