You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/05/11 03:01:32 UTC

[GitHub] [arrow-rs] nevi-me commented on issue #279: Performance improvements for take by specializing on 32 / 64 bit integer indices

nevi-me commented on issue #279:
URL: https://github.com/apache/arrow-rs/issues/279#issuecomment-837697996


   > Currently `maybe_usize` and `try_from_trusted_len_iter` are used for the `take` kernel. It seems we could do better for indices with type `u32`, `i32`, and `u64`/ `i64` (for >64 bit architecture) as we can cast to `usize` directly and use the non-optional variants which is likely faster.
   
   @Dandandan I once checked the assembly output of what the `num` crate does, as I was worried that it might be introducing overhead.
   There appeared to be no overhead. For *safe* casts like going from `u32` to `usize`, the compiler optimises out the `Option` check, and returns the result directly.
   
   Here's some example assembly output: https://godbolt.org/z/1nsq4reT7
   
   That could explain why you didn't see perf changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org