{"comment":{"created_at":"2011-10-26T17:48:46Z","body":"Is that why, on my phone, getting the list of the caches around me takes nearly 10 seconds after the data has been retrieved from gc.com? I don't remember that it was so long a few days ago.","updated_at":"2011-10-26T17:48:46Z","url":"https://api.github.com/repos/cgeo/c-geo-opensource/issues/comments/2533628","id":2533628,"user":{"avatar_url":"https://secure.gravatar.com/avatar/6e6d5c89985a1976429d28f117eb5137?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6e6d5c89985a1976429d28f117eb5137","url":"https://api.github.com/users/samueltardieu","id":44656,"login":"samueltardieu"}},"action":"created","issue":{"number":696,"created_at":"2011-10-21T17:19:35Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"When we currently store a cache, then we always load the (potentially) existing current cache with the same geocode from the database, merge the old cache into the new one and store the new one.\r\n\r\nThis is generally fine and gives correct results (so we have the most recent fields and so on). But this approach takes a huge amount of time. For most of our search operations (like \"near me\"), the storeWithMerge() is responsible for half the runtime. So it would be good if we could implement the merge differently (e.g. by only writing the newer values into the database, avoiding loading the cache details at all).\r\n\r\nYou should also think about it from this perspective: We typically get new cache information from a (online) search, but that contains only partial cache data (e.g. only the most important fields). We then load the old cache (with all the fields), copy all those fields into the new cache, and save all the fields of the new cache into the database. That way we copy the _large_ information chunk into the _small_ one. And afterwards we store _all_ fields, although only some have changed.","comments":1,"title":"storeWithMerge is bad strategy","updated_at":"2011-10-26T17:48:46Z","url":"https://api.github.com/repos/cgeo/c-geo-opensource/issues/696","id":2017603,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/f300c9887f4486fce09a63c9267dfc3c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"f300c9887f4486fce09a63c9267dfc3c","url":"https://api.github.com/users/Bananeweizen","id":406876,"login":"Bananeweizen"},"html_url":"https://github.com/cgeo/c-geo-opensource/issues/696","labels":[{"name":"refactoring","url":"https://api.github.com/repos/cgeo/c-geo-opensource/labels/refactoring","color":"e102d8"}],"state":"open"},"legacy":{"issue_id":2017603,"comment_id":2533628}}