You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/05/13 22:26:47 UTC

[GitHub] [trafficserver] bryancall commented on a change in pull request #7818: Reduces an amount of conditional checks at the cache_op

bryancall commented on a change in pull request #7818:
URL: https://github.com/apache/trafficserver/pull/7818#discussion_r632141079



##########
File path: iocore/aio/AIO.cc
##########
@@ -379,18 +379,15 @@ aio_queue_req(AIOCallbackInternal *op, int fromAPI = 0)
 static inline int
 cache_op(AIOCallbackInternal *op)
 {
-  bool read = (op->aiocb.aio_lio_opcode == LIO_READ);
+  using ActionFunc = decltype(&pread);
+  ActionFunc action = op->aiocb.aio_lio_opcode == LIO_READ ? &pread : reinterpret_cast<ActionFunc>(&pwrite);

Review comment:
       I am sorry, but I don't think the code is an improvement.  It has a decltype and a reinterpret_cast to save a bool conditional before doing a syscall.  It isn't going to effect performance.
   
   Also, it now makes debugging harder since you can't break easily on the read or write.




-- 
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