{"action":"created","issue":{"url":"https://api.github.com/repos/densh/scala-offheap/issues/39","labels_url":"https://api.github.com/repos/densh/scala-offheap/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/densh/scala-offheap/issues/39/comments","events_url":"https://api.github.com/repos/densh/scala-offheap/issues/39/events","html_url":"https://github.com/densh/scala-offheap/issues/39","id":83410386,"number":39,"title":"Support for ArrayOps functionality?","user":{"login":"flock0","id":10571893,"avatar_url":"https://avatars.githubusercontent.com/u/10571893?v=3","gravatar_id":"","url":"https://api.github.com/users/flock0","html_url":"https://github.com/flock0","followers_url":"https://api.github.com/users/flock0/followers","following_url":"https://api.github.com/users/flock0/following{/other_user}","gists_url":"https://api.github.com/users/flock0/gists{/gist_id}","starred_url":"https://api.github.com/users/flock0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flock0/subscriptions","organizations_url":"https://api.github.com/users/flock0/orgs","repos_url":"https://api.github.com/users/flock0/repos","events_url":"https://api.github.com/users/flock0/events{/privacy}","received_events_url":"https://api.github.com/users/flock0/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/densh/scala-offheap/labels/Feature","name":"Feature","color":"009800"},{"url":"https://api.github.com/repos/densh/scala-offheap/labels/Help%20Needed","name":"Help Needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-06-01T09:43:28Z","updated_at":"2015-07-20T14:27:56Z","closed_at":null,"body":"Is there the possibility / an easy way of supporting the various methods from ArrayOps?"},"comment":{"url":"https://api.github.com/repos/densh/scala-offheap/issues/comments/122902475","html_url":"https://github.com/densh/scala-offheap/issues/39#issuecomment-122902475","issue_url":"https://api.github.com/repos/densh/scala-offheap/issues/39","id":122902475,"user":{"login":"DarkDimius","id":1084930,"avatar_url":"https://avatars.githubusercontent.com/u/1084930?v=3","gravatar_id":"","url":"https://api.github.com/users/DarkDimius","html_url":"https://github.com/DarkDimius","followers_url":"https://api.github.com/users/DarkDimius/followers","following_url":"https://api.github.com/users/DarkDimius/following{/other_user}","gists_url":"https://api.github.com/users/DarkDimius/gists{/gist_id}","starred_url":"https://api.github.com/users/DarkDimius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DarkDimius/subscriptions","organizations_url":"https://api.github.com/users/DarkDimius/orgs","repos_url":"https://api.github.com/users/DarkDimius/repos","events_url":"https://api.github.com/users/DarkDimius/events{/privacy}","received_events_url":"https://api.github.com/users/DarkDimius/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T14:27:56Z","updated_at":"2015-07-20T14:27:56Z","body":">that does a malloc with the length of the original array, adds elements as they pass the predicate, then a final realloc to the actual filtered element count\r\n\r\nA trick can be done to speed this up: allocate array of longs, that has size of original array divided by 64, and set bit if predicate passes. Why longs? That's because you can collect a batch of 64 tests of predicate and make a single write. Additionally, you would maintain a counter of how many tests have succeeded. Than have a second pass that actually copies elements that have the bit set.\r\n\r\nYou could have used array of Booleans and relied on write combining inside of the CPU but as, you execute a custom user-supplied predicate, it is very easy for writes to stop being combined."}}