From 743e2047636ee7deb8dca87afd8651aa0c83bffb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 22 Aug 2013 16:53:51 +0900 Subject: 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. --- src/lib/evas/cserve2/evas_cs2_client.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib') diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c index 5721d0bd69..9bcf966339 100644 --- a/src/lib/evas/cserve2/evas_cs2_client.c +++ b/src/lib/evas/cserve2/evas_cs2_client.c @@ -1929,6 +1929,14 @@ _shared_index_item_get_by_id(Shared_Index *si, int elemsize, unsigned int id) base = si->data + sizeof(Shared_Array_Header); + // Direct access, works for non-repacked arrays + if ((int) id < high) + { + obj = (Shm_Object *) (base + (elemsize * id)); + if (obj->id == id) + return obj; + } + // Binary search start_high = high; while(high != low) -- cgit v1.2.1