{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/232","labels_url":"https://api.github.com/repos/systemjs/builder/issues/232/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/232/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/232/events","html_url":"https://github.com/systemjs/builder/issues/232","id":95184066,"number":232,"title":"Trace cache","user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars.githubusercontent.com/u/598730?v=3","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/systemjs/builder/labels/feature","name":"feature","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-15T12:51:21Z","updated_at":"2015-07-18T21:15:04Z","closed_at":null,"body":"GoCardless report their build went down from 5s to 1.8s using a build cache object. The remaining 1.8s should be possible to reduce significantly with a trace cache.\r\n\r\nThe way this would work is that the `cache` object is extended to have two top-level keys - `cache.loads` and `cache.compiles`. For the trace and compile caches respectively. The `cache.compiles` would be exactly as the current cache object handles. The `cache.loads` would then simply include the load records as traced from `bulider.loader.loads`. Serialization of this object would be harder than for the compile cache as it has some self-referencing, but it may be possible to sanitize these out first to make a more cache-friendly representation.\r\n\r\nPlugging the trace cache into the loader itself will require some extension to the loader mechanics.\r\n\r\nTrace cache invalidation could be left entirely to the end-user. Or it could be worth considering a better invalidation API around this. Perhaps something like:\r\n\r\n```javascript\r\nbuilder.setCache(cacheObj, invalidationFunction);\r\n```\r\n\r\nWhere `invalidationFunction` is run against each load record in the trace, with the information, allowing easy custom invalidation. Perhaps that is overkill, but just throwing out ideas here.\r\n\r\n//cc @jackfranklin"},"comment":{"url":"https://api.github.com/repos/systemjs/builder/issues/comments/122597444","html_url":"https://github.com/systemjs/builder/issues/232#issuecomment-122597444","issue_url":"https://api.github.com/repos/systemjs/builder/issues/232","id":122597444,"user":{"login":"jackfranklin","id":193238,"avatar_url":"https://avatars.githubusercontent.com/u/193238?v=3","gravatar_id":"","url":"https://api.github.com/users/jackfranklin","html_url":"https://github.com/jackfranklin","followers_url":"https://api.github.com/users/jackfranklin/followers","following_url":"https://api.github.com/users/jackfranklin/following{/other_user}","gists_url":"https://api.github.com/users/jackfranklin/gists{/gist_id}","starred_url":"https://api.github.com/users/jackfranklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackfranklin/subscriptions","organizations_url":"https://api.github.com/users/jackfranklin/orgs","repos_url":"https://api.github.com/users/jackfranklin/repos","events_url":"https://api.github.com/users/jackfranklin/events{/privacy}","received_events_url":"https://api.github.com/users/jackfranklin/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T21:15:04Z","updated_at":"2015-07-18T21:15:04Z","body":"@guybedford :+1: sounds pretty perfect. Let me know if I can be of any more use. We're about to move to incremental builds at GC so if we can be guinea pigs, you know where we are!"}}