andygrove commented on pull request #8901:
URL: https://github.com/apache/arrow/pull/8901#issuecomment-745379959


   I saw a tweet yesterday from @timClicks showing an example of how the 
imageproc project documents their unsafe code and I really like it. I think we 
should do something similiar. Maybe we could add this to the guidelines 
@jorgecarleitao ?
   
   ```rust
               // JUSTIFICATION
               //  Benefit
               //      Using checked indexing here makes 
bench_integral_image_rgb take 1.05x as long
               //      (The results are noisy, but this seems to be 
reproducible. I've not checked the generated assembly.)
               //  Correctness
               //      x and y are within bounds by definition of in_width and 
in_height
               let input = unsafe { image.unsafe_get_pixel(x, y) };
   ```


----------------------------------------------------------------
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:
[email protected]


Reply via email to