{"action":"created","issue":{"url":"https://api.github.com/repos/ds300/derivablejs/issues/37","repository_url":"https://api.github.com/repos/ds300/derivablejs","labels_url":"https://api.github.com/repos/ds300/derivablejs/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/ds300/derivablejs/issues/37/comments","events_url":"https://api.github.com/repos/ds300/derivablejs/issues/37/events","html_url":"https://github.com/ds300/derivablejs/pull/37","id":150650472,"number":37,"title":"New Algorithm","user":{"login":"ds300","id":1242537,"avatar_url":"https://avatars.githubusercontent.com/u/1242537?v=3","gravatar_id":"","url":"https://api.github.com/users/ds300","html_url":"https://github.com/ds300","followers_url":"https://api.github.com/users/ds300/followers","following_url":"https://api.github.com/users/ds300/following{/other_user}","gists_url":"https://api.github.com/users/ds300/gists{/gist_id}","starred_url":"https://api.github.com/users/ds300/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ds300/subscriptions","organizations_url":"https://api.github.com/users/ds300/orgs","repos_url":"https://api.github.com/users/ds300/repos","events_url":"https://api.github.com/users/ds300/events{/privacy}","received_events_url":"https://api.github.com/users/ds300/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-04-24T10:53:07Z","updated_at":"2016-08-10T07:01:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ds300/derivablejs/pulls/37","html_url":"https://github.com/ds300/derivablejs/pull/37","diff_url":"https://github.com/ds300/derivablejs/pull/37.diff","patch_url":"https://github.com/ds300/derivablejs/pull/37.patch"},"body":"Up until now, DerivableJS used a mark-and-sweep style algorithm to both propagate change and free unused memory.\r\n\r\nThis had a couple of minor performance implications, and one obscure-but-serious memory leak vulnerability (see #36).\r\n\r\nThis reimplementation of DerivableJS' core data structures removes the mark-and-sweep stuff, replacing it with a significantly simpler system inspired by Clojure's epochal STM.\r\n\r\nThe practical implications are: \r\n\r\n- atoms never ever store references to derivations. Only to reactors. This is ideal, and solves the memory management issue once and for all.\r\n- the time complexity of updating atoms is now linear in the number of dependent reactors rather than in the number of dependent (derivations + reactors), and should be much more performant due to cache locality goodness.\r\n- the cost of dereferencing derivables should be either similar or faster than before, but I'll have to do benchmarking to be sure of this.\r\n- smaller file size (.min.gz has gone from **4,330 bytes** down to **3,718 bytes**. Makes all the difference.)\r\n\r\nThe progress of this reimplementation is as follows:\r\n\r\n- [x] typescript prototype of epochal system to verify viability \r\n- [x] retrofit DJS with epochal system\r\n- [x] get all the unit tests passing\r\n- [x] trial epochal system in real-world projects already using DJS\r\n- [x] modernize code base (npm build scripts, es6 modules + rollup, CI)\r\n- [x] do white box testing. get 100% test coverage.\r\n- [x] check performance and rework if necessary\r\n- [ ] modify read-me to talk about push-pull as opposed to mark-and-sweep, like [Agera](https://github.com/google/agera)\r\n- [ ] release"},"comment":{"url":"https://api.github.com/repos/ds300/derivablejs/issues/comments/238782473","html_url":"https://github.com/ds300/derivablejs/pull/37#issuecomment-238782473","issue_url":"https://api.github.com/repos/ds300/derivablejs/issues/37","id":238782473,"user":{"login":"mruzekw","id":108522,"avatar_url":"https://avatars.githubusercontent.com/u/108522?v=3","gravatar_id":"","url":"https://api.github.com/users/mruzekw","html_url":"https://github.com/mruzekw","followers_url":"https://api.github.com/users/mruzekw/followers","following_url":"https://api.github.com/users/mruzekw/following{/other_user}","gists_url":"https://api.github.com/users/mruzekw/gists{/gist_id}","starred_url":"https://api.github.com/users/mruzekw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mruzekw/subscriptions","organizations_url":"https://api.github.com/users/mruzekw/orgs","repos_url":"https://api.github.com/users/mruzekw/repos","events_url":"https://api.github.com/users/mruzekw/events{/privacy}","received_events_url":"https://api.github.com/users/mruzekw/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T07:01:12Z","updated_at":"2016-08-10T07:01:12Z","body":"I would love to see a CQRS example in the mix. Just to give an idea of how to structure a larger application. I notice there's a redux-like example here: https://github.com/andreypopp/react-derivable#fluxredux-like-unidirectional-data-flow"}}
{"actor":{"display_login":"mruzekw"}}