{"action":"created","issue":{"url":"https://api.github.com/repos/zopefoundation/ZEO/issues/48","repository_url":"https://api.github.com/repos/zopefoundation/ZEO","labels_url":"https://api.github.com/repos/zopefoundation/ZEO/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/zopefoundation/ZEO/issues/48/comments","events_url":"https://api.github.com/repos/zopefoundation/ZEO/issues/48/events","html_url":"https://github.com/zopefoundation/ZEO/pull/48","id":165671590,"number":48,"title":"Optimizations, featuring prefetch","user":{"login":"jimfulton","id":772727,"avatar_url":"https://avatars.githubusercontent.com/u/772727?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfulton","html_url":"https://github.com/jimfulton","followers_url":"https://api.github.com/users/jimfulton/followers","following_url":"https://api.github.com/users/jimfulton/following{/other_user}","gists_url":"https://api.github.com/users/jimfulton/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfulton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfulton/subscriptions","organizations_url":"https://api.github.com/users/jimfulton/orgs","repos_url":"https://api.github.com/users/jimfulton/repos","events_url":"https://api.github.com/users/jimfulton/events{/privacy}","received_events_url":"https://api.github.com/users/jimfulton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-07-14T22:18:47Z","updated_at":"2016-07-16T13:17:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zopefoundation/ZEO/pulls/48","html_url":"https://github.com/zopefoundation/ZEO/pull/48","diff_url":"https://github.com/zopefoundation/ZEO/pull/48.diff","patch_url":"https://github.com/zopefoundation/ZEO/pull/48.patch"},"body":"This PR has 3 optimizations:\r\n\r\n- On load, check cache in calling thread rather than the networking thread. This improves cache read performance ~4x in my tests.\r\n\r\n- Implemented a prefetch method, which allows you to get loads in progress asynchronously before loading them.  If you're good at predicting what you're going to load, then this can speeds significantly. (In my testing, this was about 60%, but would likely be more in a more realistic situation.)\r\n\r\n- Collapse load requests. When there is an inflight loadBefore request, and the same request is made again, it uses the  inflight requests result rather than making a server call. This was needed to make prefetch effective."},"comment":{"url":"https://api.github.com/repos/zopefoundation/ZEO/issues/comments/233129968","html_url":"https://github.com/zopefoundation/ZEO/pull/48#issuecomment-233129968","issue_url":"https://api.github.com/repos/zopefoundation/ZEO/issues/48","id":233129968,"user":{"login":"jamadden","id":1256082,"avatar_url":"https://avatars.githubusercontent.com/u/1256082?v=3","gravatar_id":"","url":"https://api.github.com/users/jamadden","html_url":"https://github.com/jamadden","followers_url":"https://api.github.com/users/jamadden/followers","following_url":"https://api.github.com/users/jamadden/following{/other_user}","gists_url":"https://api.github.com/users/jamadden/gists{/gist_id}","starred_url":"https://api.github.com/users/jamadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamadden/subscriptions","organizations_url":"https://api.github.com/users/jamadden/orgs","repos_url":"https://api.github.com/users/jamadden/repos","events_url":"https://api.github.com/users/jamadden/events{/privacy}","received_events_url":"https://api.github.com/users/jamadden/received_events","type":"User","site_admin":false},"created_at":"2016-07-16T13:17:45Z","updated_at":"2016-07-16T13:17:45Z","body":">> I'll be curious to see how this gets exposed at the ZODB layer.\r\n\r\n> Didn't you see this:\r\nhttps://groups.google.com/forum/#!topic/zodb/RtpQiK5AYj0\r\n\r\nI did, but I was thinking more about implementation details. This isn't useful for some (synchronous) storages, so they can either not implement such a method or implement it as a no-op; so it can either be an optional part of the IStorage interface and checked for with `hasattr` or `try/except AttributeError` before calling, or they can be expected to implement it to do nothing, or it can be a new interface that's checked for, or something else...It's not especially important, I'm just curious 😃 .\r\n\r\n> Anyway, a callback API begs for anonymous functions, which Python lacks\r\n> (excluding lambdas, of course).  My typical work-around is to use\r\n> decorators.  Almost any time you see me use a decorator on an inner\r\n> function, the inner function is a callback.\r\n\r\nI see. I would never have guessed. I found it confusing because it looks like a function definition just sitting there, doing nothing. It's rare to see decorators that have such *immediate, necessary side-effects*. I think i would prefer the imperative `then` style, myself, just because it *looks* like it's doing something.\r\n\r\nIn `@self.protocol.promise('loadBefore', oid, tid)` I can see what you mean, but that got changed to `@self.protocol.load_before(oid, tid)`, which I guess is a short-cut for the former? It lacks the `promise` wording though, so I wasn't sure. \r\n\r\nAgain, I'm not trying to disparage the design. I just haven't read enough of the surrounding code to understand what's going on here from this snippet and the changes it contains."}}
{"actor":{"display_login":"jamadden"}}