{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/14137","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/14137/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/14137/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/14137/events","html_url":"https://github.com/JuliaLang/julia/issues/14137","id":118870761,"number":14137,"title":"Builtins returning signed integers","user":{"login":"maleadt","id":383068,"avatar_url":"https://avatars.githubusercontent.com/u/383068?v=3","gravatar_id":"","url":"https://api.github.com/users/maleadt","html_url":"https://github.com/maleadt","followers_url":"https://api.github.com/users/maleadt/followers","following_url":"https://api.github.com/users/maleadt/following{/other_user}","gists_url":"https://api.github.com/users/maleadt/gists{/gist_id}","starred_url":"https://api.github.com/users/maleadt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maleadt/subscriptions","organizations_url":"https://api.github.com/users/maleadt/orgs","repos_url":"https://api.github.com/users/maleadt/repos","events_url":"https://api.github.com/users/maleadt/events{/privacy}","received_events_url":"https://api.github.com/users/maleadt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-25T16:15:13Z","updated_at":"2015-11-25T16:33:52Z","closed_at":null,"body":"I was looking into a codegen difference (ccall using `Cstring` vs `Ptr{UInt8}`, based on a comment on #14024) and one of the differences was a check + branch throwing `jl_inexact_exception` when converting the string. Turns out the underlying cause is `jl_f_sizeof` returning a signed rather than an unsigned integer.\r\n\r\nIn C, `sizeof` returns an unsigned `size_t`. I assume this makes sense in Julia as well, and it should get rid of at least some checked conversions (completely unscientific gut feeling). In case of my micro-benchmark with `Cstring`s, overhead dropped from ~10% to ~8%.\r\n\r\nDoes it make sense to explore this further, or are there existential issues I'm not seeing? An initial `testall` yielded many failures, but most were signature mismatches which should be trivial to fix. A bigger problem seems to be that `jl_datatype_t.size` is signed."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/159664294","html_url":"https://github.com/JuliaLang/julia/issues/14137#issuecomment-159664294","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/14137","id":159664294,"user":{"login":"maleadt","id":383068,"avatar_url":"https://avatars.githubusercontent.com/u/383068?v=3","gravatar_id":"","url":"https://api.github.com/users/maleadt","html_url":"https://github.com/maleadt","followers_url":"https://api.github.com/users/maleadt/followers","following_url":"https://api.github.com/users/maleadt/following{/other_user}","gists_url":"https://api.github.com/users/maleadt/gists{/gist_id}","starred_url":"https://api.github.com/users/maleadt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maleadt/subscriptions","organizations_url":"https://api.github.com/users/maleadt/orgs","repos_url":"https://api.github.com/users/maleadt/repos","events_url":"https://api.github.com/users/maleadt/events{/privacy}","received_events_url":"https://api.github.com/users/maleadt/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T16:33:52Z","updated_at":"2015-11-25T16:33:52Z","body":"Yeah, it seems to break quite a lot :-) Just getting rid of the signedness seemed too much like an ad-hoc fix while there might be other optimization opportunities, but you're probably right that the fallout would be massive. I'll have a look at assessing the performance gains, if any."}}