{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/9811","labels_url":"https://api.github.com/repos/sympy/sympy/issues/9811/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/9811/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/9811/events","html_url":"https://github.com/sympy/sympy/pull/9811","id":100357659,"number":9811,"title":"Use xreplace instead of subs in Derivative instantiation","user":{"login":"oliverlee","id":2965031,"avatar_url":"https://avatars.githubusercontent.com/u/2965031?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverlee","html_url":"https://github.com/oliverlee","followers_url":"https://api.github.com/users/oliverlee/followers","following_url":"https://api.github.com/users/oliverlee/following{/other_user}","gists_url":"https://api.github.com/users/oliverlee/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverlee/subscriptions","organizations_url":"https://api.github.com/users/oliverlee/orgs","repos_url":"https://api.github.com/users/oliverlee/repos","events_url":"https://api.github.com/users/oliverlee/events{/privacy}","received_events_url":"https://api.github.com/users/oliverlee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-11T16:54:13Z","updated_at":"2015-08-11T17:42:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/9811","html_url":"https://github.com/sympy/sympy/pull/9811","diff_url":"https://github.com/sympy/sympy/pull/9811.diff","patch_url":"https://github.com/sympy/sympy/pull/9811.patch"},"body":"Speedup differentiation of expressions by using xreplace instead of\r\nsubs.\r\n\r\nThis addresses https://github.com/sympy/sympy/issues/9701 #9705"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/129986272","html_url":"https://github.com/sympy/sympy/pull/9811#issuecomment-129986272","issue_url":"https://api.github.com/repos/sympy/sympy/issues/9811","id":129986272,"user":{"login":"moorepants","id":276007,"avatar_url":"https://avatars.githubusercontent.com/u/276007?v=3","gravatar_id":"","url":"https://api.github.com/users/moorepants","html_url":"https://github.com/moorepants","followers_url":"https://api.github.com/users/moorepants/followers","following_url":"https://api.github.com/users/moorepants/following{/other_user}","gists_url":"https://api.github.com/users/moorepants/gists{/gist_id}","starred_url":"https://api.github.com/users/moorepants/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moorepants/subscriptions","organizations_url":"https://api.github.com/users/moorepants/orgs","repos_url":"https://api.github.com/users/moorepants/repos","events_url":"https://api.github.com/users/moorepants/events{/privacy}","received_events_url":"https://api.github.com/users/moorepants/received_events","type":"User","site_admin":false},"created_at":"2015-08-11T17:42:20Z","updated_at":"2015-08-11T17:42:20Z","body":"This shows the caching effects.\r\n\r\nMaster:\r\n\r\n```\r\nIn [1]: from pydy.models import n_link_pendulum_on_cart\r\n\r\nIn [2]: sys = n_link_pendulum_on_cart(5)\r\n/home/moorepants/anaconda/lib/python2.7/site-packages/pydy/system.py:102: PyDyFutureWarning: PyDy System is experimental and may change in the future.\r\n  warnings.warn(msg, PyDyFutureWarning)\r\n\r\nIn [3]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 1.61 s, sys: 48.7 ms, total: 1.66 s\r\nWall time: 1.62 s\r\n\r\nIn [4]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 1.39 s, sys: 73.4 ms, total: 1.46 s\r\nWall time: 1.4 s\r\n\r\nIn [5]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 1.17 s, sys: 57.3 ms, total: 1.23 s\r\nWall time: 1.18 s\r\n\r\nIn [6]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 1.19 s, sys: 24.1 ms, total: 1.21 s\r\nWall time: 1.19 s\r\n\r\nIn [7]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 1.16 s, sys: 65.1 ms, total: 1.22 s\r\nWall time: 1.17 s\r\n```\r\n\r\nThis PR:\r\n\r\n```\r\nIn [1]: from pydy.models import n_link_pendulum_on_cart\r\n\r\nIn [2]: sys = n_link_pendulum_on_cart(5)\r\n/home/moorepants/anaconda/lib/python2.7/site-packages/pydy/system.py:102: PyDyFutureWarning: PyDy System is experimental and may change in the future.\r\n  warnings.warn(msg, PyDyFutureWarning)\r\n\r\nIn [3]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 759 ms, sys: 16.3 ms, total: 776 ms\r\nWall time: 771 ms\r\n\r\nIn [4]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 310 ms, sys: 46 ms, total: 356 ms\r\nWall time: 313 ms\r\n\r\nIn [5]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 127 ms, sys: 16.6 ms, total: 144 ms\r\nWall time: 135 ms\r\n\r\nIn [6]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 164 ms, sys: 21.7 ms, total: 186 ms\r\nWall time: 159 ms\r\n\r\nIn [7]: %time f = sys.eom_method.forcing.jacobian(sys.states)\r\nCPU times: user 146 ms, sys: 3.93 ms, total: 150 ms\r\nWall time: 142 ms\r\n```"}}