{"action":"created","issue":{"url":"https://api.github.com/repos/okamstudio/godot/issues/2351","labels_url":"https://api.github.com/repos/okamstudio/godot/issues/2351/labels{/name}","comments_url":"https://api.github.com/repos/okamstudio/godot/issues/2351/comments","events_url":"https://api.github.com/repos/okamstudio/godot/issues/2351/events","html_url":"https://github.com/okamstudio/godot/pull/2351","id":99938454,"number":2351,"title":"SIMD optimization for AABB::intersects_segment","user":{"login":"jjdicharry","id":12058304,"avatar_url":"https://avatars.githubusercontent.com/u/12058304?v=3","gravatar_id":"","url":"https://api.github.com/users/jjdicharry","html_url":"https://github.com/jjdicharry","followers_url":"https://api.github.com/users/jjdicharry/followers","following_url":"https://api.github.com/users/jjdicharry/following{/other_user}","gists_url":"https://api.github.com/users/jjdicharry/gists{/gist_id}","starred_url":"https://api.github.com/users/jjdicharry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjdicharry/subscriptions","organizations_url":"https://api.github.com/users/jjdicharry/orgs","repos_url":"https://api.github.com/users/jjdicharry/repos","events_url":"https://api.github.com/users/jjdicharry/events{/privacy}","received_events_url":"https://api.github.com/users/jjdicharry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-09T23:04:56Z","updated_at":"2015-08-09T23:14:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/okamstudio/godot/pulls/2351","html_url":"https://github.com/okamstudio/godot/pull/2351","diff_url":"https://github.com/okamstudio/godot/pull/2351.diff","patch_url":"https://github.com/okamstudio/godot/pull/2351.patch"},"body":"\"AABB::intersects_segment\" is optimized with Intel SSE instructions and runs ~2X as fast as the original.\r\n\r\nRunning:\r\nvalgrind --tool=callgrind --toggle-collect=TestAABB::test_aabb* --cache-sim=yes --branch-sim=yes ./bin/godot.x11.64 -test aabb\r\n\r\nthen:\r\nkcachegrind callgrind.out.*\r\n\r\n\r\nNormal binary output shows a cycle estimation of 971474:\r\n![KCachegrind AABB No SIMD](https://cloud.githubusercontent.com/assets/12058304/9157410/0a159de4-3eb1-11e5-8e0e-ee12cefd18b2.png)\r\n\r\n\r\nSIMD optimized binary shows a cycle estimation of 515142:\r\n\r\n![KCachegrind AABB SIMD](https://cloud.githubusercontent.com/assets/12058304/9157365/b08a69fe-3eaf-11e5-913a-e0c420ead69d.png)\r\n\r\nNOTE: Only optimized for GCC, Intel SSE, and single precision floating point!  It will compile on other platforms but won't be optimized.\r\n"},"comment":{"url":"https://api.github.com/repos/okamstudio/godot/issues/comments/129260054","html_url":"https://github.com/okamstudio/godot/pull/2351#issuecomment-129260054","issue_url":"https://api.github.com/repos/okamstudio/godot/issues/2351","id":129260054,"user":{"login":"reduz","id":6265307,"avatar_url":"https://avatars.githubusercontent.com/u/6265307?v=3","gravatar_id":"","url":"https://api.github.com/users/reduz","html_url":"https://github.com/reduz","followers_url":"https://api.github.com/users/reduz/followers","following_url":"https://api.github.com/users/reduz/following{/other_user}","gists_url":"https://api.github.com/users/reduz/gists{/gist_id}","starred_url":"https://api.github.com/users/reduz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reduz/subscriptions","organizations_url":"https://api.github.com/users/reduz/orgs","repos_url":"https://api.github.com/users/reduz/repos","events_url":"https://api.github.com/users/reduz/events{/privacy}","received_events_url":"https://api.github.com/users/reduz/received_events","type":"User","site_admin":false},"created_at":"2015-08-09T23:14:02Z","updated_at":"2015-08-09T23:14:02Z","body":"this is pretty cool, I was planning to do a whole overhaul of the math\nstuff using simd after next version, so will most likely use this PR as a\nbase\n\nOn Sun, Aug 9, 2015 at 8:05 PM, jjdicharry <notifications@github.com> wrote:\n\n> \"AABB::intersects_segment\" is optimized with Intel SSE instructions and\n> runs ~2X as fast as the original.\n>\n> Running:\n> valgrind --tool=callgrind --toggle-collect=TestAABB::test_aabb*\n> --cache-sim=yes --branch-sim=yes ./bin/godot.x11.64 -test aabb\n>\n> then:\n> kcachegrind callgrind.out.*\n>\n> Normal binary output shows a cycle estimation of 971474:\n>\n> [image: kcachgrind_aabb_nosimd]\n> <https://cloud.githubusercontent.com/assets/12058304/9157352/4c2e72e8-3eaf-11e5-9e41-9d7ed4dfa429.jpg>\n>\n> SIMD optimized binary shows a cycle estimation of 515142:\n>\n> [image: kcachegrind_aabb_simd]\n> <https://cloud.githubusercontent.com/assets/12058304/9157365/b08a69fe-3eaf-11e5-913a-e0c420ead69d.png>\n>\n> NOTE: Only optimized for GCC, Intel SSE, and single precision floating\n> point! It will compile on other platforms but won't be optimized.\n> ------------------------------\n> You can view, comment on, or merge this pull request online at:\n>\n>   https://github.com/okamstudio/godot/pull/2351\n> Commit Summary\n>\n>    - Fixed resource binary reading for quad vector3.\n>    - Optimizing Vector3 and add test.\n>    - Added vector optimization for AABB::intersects_segment.\n>    - Will handle optimization for double precision later.\n>\n> File Changes\n>\n>    - *A* bin/tests/test_aabb.cpp\n>    <https://github.com/okamstudio/godot/pull/2351/files#diff-0> (94)\n>    - *M* bin/tests/test_main.cpp\n>    <https://github.com/okamstudio/godot/pull/2351/files#diff-1> (6)\n>    - *M* core/io/resource_format_binary.cpp\n>    <https://github.com/okamstudio/godot/pull/2351/files#diff-2> (40)\n>    - *M* core/math/aabb.cpp\n>    <https://github.com/okamstudio/godot/pull/2351/files#diff-3> (87)\n>    - *A* core/math/vector3_simd.cpp\n>    <https://github.com/okamstudio/godot/pull/2351/files#diff-4> (187)\n>    - *A* core/math/vector3_simd.h\n>    <https://github.com/okamstudio/godot/pull/2351/files#diff-5> (530)\n>\n> Patch Links:\n>\n>    - https://github.com/okamstudio/godot/pull/2351.patch\n>    - https://github.com/okamstudio/godot/pull/2351.diff\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/okamstudio/godot/pull/2351>.\n>\n"}}