{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/8964","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/8964/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/8964/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/8964/events","html_url":"https://github.com/JuliaLang/julia/pull/8964","id":48287534,"number":8964,"title":"ByteVec: immediate / remote immutable byte vectors + intrinsics.","user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2014-11-10T17:03:48Z","updated_at":"2015-05-01T03:29:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/8964","html_url":"https://github.com/JuliaLang/julia/pull/8964","diff_url":"https://github.com/JuliaLang/julia/pull/8964.diff","patch_url":"https://github.com/JuliaLang/julia/pull/8964.patch"},"body":"I ended up going with @vtjnash's suggestion of representing this as an Int128 since that makes the code generation easier: you can cast the `Int128` to various vector types like `Uint8 x 8` or `Int x 2`, which are both handy for writing `bytevec_len` and `bytevec_ref` intrinsics.\r\n\r\nThe code generation is already pretty decent, e.g.:\r\n\r\n\tjulia> s = Str(\"Hello\")\r\n\t\"Hello\"\r\n\r\n\tjulia> @code_native sizeof(s)\r\n\t\t.section\t__TEXT,__text,regular,pure_instructions\r\n\tFilename: bytes.jl\r\n\tSource line: 64\r\n\t\tpush\tRBP\r\n\t\tmov\tRBP, RSP\r\n\tSource line: 64\r\n\t\tmov\tRAX, QWORD PTR [RDI + 8]\r\n\t\tvmovq\tXMM0, QWORD PTR [RAX + 16]\r\n\t\tvmovq\tXMM1, QWORD PTR [RAX + 8]\r\n\t\tvpunpcklqdq\tXMM0, XMM1, XMM0 ## xmm0 = xmm1[0],xmm0[0]\r\n\t\tvpextrq\tRAX, XMM0, 1\r\n\t\tneg\tRAX\r\n\t\tvpextrb\tECX, XMM0, 15\r\n\t\ttest\tCL, CL\r\n\t\tcmovns\tRAX, RCX\r\n\t\tpop\tRBP\r\n\t\tret\r\n\r\nOne area to investigate optimization is to try to make sure that the checks involved in loading a single byte can be hoisted out of loops *and* ideally, we want, instead of a loop with a branch inside of it a branch with a loop inside of each path, but that's a bit of a more tricky optimization than I think we're doing now. But with that code that iterates strings could really fly.\r\n\r\nNext steps are to implement `bytevec_eq` and `bytevec_cmp` intrinsics. I know these aren't strictly necessary, but I suspect that the built-in versions can be made very efficient."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/98036144","html_url":"https://github.com/JuliaLang/julia/pull/8964#issuecomment-98036144","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/8964","id":98036144,"user":{"login":"ScottPJones","id":11798751,"avatar_url":"https://avatars.githubusercontent.com/u/11798751?v=3","gravatar_id":"","url":"https://api.github.com/users/ScottPJones","html_url":"https://github.com/ScottPJones","followers_url":"https://api.github.com/users/ScottPJones/followers","following_url":"https://api.github.com/users/ScottPJones/following{/other_user}","gists_url":"https://api.github.com/users/ScottPJones/gists{/gist_id}","starred_url":"https://api.github.com/users/ScottPJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScottPJones/subscriptions","organizations_url":"https://api.github.com/users/ScottPJones/orgs","repos_url":"https://api.github.com/users/ScottPJones/repos","events_url":"https://api.github.com/users/ScottPJones/events{/privacy}","received_events_url":"https://api.github.com/users/ScottPJones/received_events","type":"User","site_admin":false},"created_at":"2015-05-01T03:29:30Z","updated_at":"2015-05-01T03:29:30Z","body":"@nalimilan Just one thing though - do you insist on only a single number type? That's where your reasoning leads..."}}