summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-08-22 16:53:51 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:14 +0900
commit743e2047636ee7deb8dca87afd8651aa0c83bffb (patch)
tree805ddf83c12743e1a1fed02f401921bc9e37aced /src/bin
parent71fdd0d3426868dff7f8a9df785f5ef1a20a4c87 (diff)
evas/cserve2: Optimize shared strings
Shared string indexes are not repacked, since they live in a memory pool (where the indexes can be reused). So, the index in the table is equal to their ID. Add initial test to check if the item at index n has the ID n.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/evas/evas_cserve2_index.c8
-rw-r--r--src/bin/evas/evas_cserve2_shm_debug.c8
2 files changed, 16 insertions, 0 deletions
diff --git a/src/bin/evas/evas_cserve2_index.c b/src/bin/evas/evas_cserve2_index.c
index 699ef95064..816a686d23 100644
--- a/src/bin/evas/evas_cserve2_index.c
+++ b/src/bin/evas/evas_cserve2_index.c
@@ -544,6 +544,14 @@ _shared_index_entry_get_by_id(Shared_Index *si, unsigned int id)
544 base = si->sa->ds->data + sizeof(Shared_Array_Header); 544 base = si->sa->ds->data + sizeof(Shared_Array_Header);
545 elemsize = si->sa->header->elemsize; 545 elemsize = si->sa->header->elemsize;
546 546
547 // Direct access, works for non-repacked arrays
548 if ((int) id < high)
549 {
550 obj = (Index_Entry *) (base + (elemsize * id));
551 if (obj->id == id)
552 return obj;
553 }
554
547 // Binary search 555 // Binary search
548 start_high = high; 556 start_high = high;
549 while(high != low) 557 while(high != low)
diff --git a/src/bin/evas/evas_cserve2_shm_debug.c b/src/bin/evas/evas_cserve2_shm_debug.c
index e17e5d2b40..bde62bd89b 100644
--- a/src/bin/evas/evas_cserve2_shm_debug.c
+++ b/src/bin/evas/evas_cserve2_shm_debug.c
@@ -286,6 +286,14 @@ _shared_index_item_get_by_id(Shm_File *si, int elemsize, unsigned int id)
286 286
287 base = si->data + sizeof(Shared_Array_Header); 287 base = si->data + sizeof(Shared_Array_Header);
288 288
289 // Direct access, works for non-repacked arrays
290 if ((int) id < high)
291 {
292 obj = (Shm_Object *) (base + (elemsize * id));
293 if (obj->id == id)
294 return obj;
295 }
296
289 // Binary search 297 // Binary search
290 start_high = high; 298 start_high = high;
291 while(high != low) 299 while(high != low)