diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2013-08-22 16:53:51 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2013-10-28 15:47:14 +0900 |
commit | 743e2047636ee7deb8dca87afd8651aa0c83bffb (patch) | |
tree | 805ddf83c12743e1a1fed02f401921bc9e37aced /src/lib/evas/cserve2/evas_cs2_client.c | |
parent | 71fdd0d3426868dff7f8a9df785f5ef1a20a4c87 (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/lib/evas/cserve2/evas_cs2_client.c')
-rw-r--r-- | src/lib/evas/cserve2/evas_cs2_client.c | 8 |
1 files changed, 8 insertions, 0 deletions
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) | |||
1929 | 1929 | ||
1930 | base = si->data + sizeof(Shared_Array_Header); | 1930 | base = si->data + sizeof(Shared_Array_Header); |
1931 | 1931 | ||
1932 | // Direct access, works for non-repacked arrays | ||
1933 | if ((int) id < high) | ||
1934 | { | ||
1935 | obj = (Shm_Object *) (base + (elemsize * id)); | ||
1936 | if (obj->id == id) | ||
1937 | return obj; | ||
1938 | } | ||
1939 | |||
1932 | // Binary search | 1940 | // Binary search |
1933 | start_high = high; | 1941 | start_high = high; |
1934 | while(high != low) | 1942 | while(high != low) |