{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/hxcpp/issues/455","repository_url":"https://api.github.com/repos/HaxeFoundation/hxcpp","labels_url":"https://api.github.com/repos/HaxeFoundation/hxcpp/issues/455/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/hxcpp/issues/455/comments","events_url":"https://api.github.com/repos/HaxeFoundation/hxcpp/issues/455/events","html_url":"https://github.com/HaxeFoundation/hxcpp/issues/455","id":155396281,"number":455,"title":"Modulo operation performance","user":{"login":"troyc","id":249510,"avatar_url":"https://avatars.githubusercontent.com/u/249510?v=3","gravatar_id":"","url":"https://api.github.com/users/troyc","html_url":"https://github.com/troyc","followers_url":"https://api.github.com/users/troyc/followers","following_url":"https://api.github.com/users/troyc/following{/other_user}","gists_url":"https://api.github.com/users/troyc/gists{/gist_id}","starred_url":"https://api.github.com/users/troyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troyc/subscriptions","organizations_url":"https://api.github.com/users/troyc/orgs","repos_url":"https://api.github.com/users/troyc/repos","events_url":"https://api.github.com/users/troyc/events{/privacy}","received_events_url":"https://api.github.com/users/troyc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-18T01:06:53Z","updated_at":"2016-06-02T04:53:10Z","closed_at":"2016-06-02T04:53:10Z","body":"I was messing around with some simple benchmarks and noticed that this benchmark took 15s to complete in hxcpp, but only 3s in native C++:\r\n\r\nHaxe:\r\n```\r\n\tvar foo:Int = 1;\r\n\tfor (x in 0...1000000000)\r\n\t{\r\n\t\tfoo *= 7;\r\n\t\tfoo %= 337;\r\n\t}\r\n```\r\n\r\nC++\r\n```\r\n\tint foo = 1;\r\n\tfor (int x = 0; x < 1000000000; x++)\r\n\t{\r\n\t\tfoo *= 7;\r\n\t\tfoo %= 337;\r\n\t}\r\n```\r\n\r\nThe source code calls hx::ModEq(foo,(int)337) which in turn calls doublemod (which calls fmod), converting both parameters to double. Is this something that should be optimized?"},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/hxcpp/issues/comments/223195080","html_url":"https://github.com/HaxeFoundation/hxcpp/issues/455#issuecomment-223195080","issue_url":"https://api.github.com/repos/HaxeFoundation/hxcpp/issues/455","id":223195080,"user":{"login":"hughsando","id":1665494,"avatar_url":"https://avatars.githubusercontent.com/u/1665494?v=3","gravatar_id":"","url":"https://api.github.com/users/hughsando","html_url":"https://github.com/hughsando","followers_url":"https://api.github.com/users/hughsando/followers","following_url":"https://api.github.com/users/hughsando/following{/other_user}","gists_url":"https://api.github.com/users/hughsando/gists{/gist_id}","starred_url":"https://api.github.com/users/hughsando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughsando/subscriptions","organizations_url":"https://api.github.com/users/hughsando/orgs","repos_url":"https://api.github.com/users/hughsando/repos","events_url":"https://api.github.com/users/hughsando/events{/privacy}","received_events_url":"https://api.github.com/users/hughsando/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T04:53:10Z","updated_at":"2016-06-02T04:53:10Z","body":"In 3.3rc, this code runs as fast as your native example:\r\n```\r\n   using cpp.NativeMath;\r\n\r\n       var foo:Int = 1;\r\n       for (x in 0...1000000000)\r\n       {\r\n           foo *= 7;\r\n           foo = foo.imod(337);\r\n       }\r\n```\r\nSlightly more verbose, but it gets around some thing in the specification that I really don't feel like messing with."}}
{"actor":{"display_login":"hughsando"}}