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 2020/06/02 17:26:37 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #7330: ARROW-8951: [C++] Fix compiler warnings on gcc8 in release builds

pitrou commented on a change in pull request #7330:
URL: https://github.com/apache/arrow/pull/7330#discussion_r434047931



##########
File path: cpp/src/arrow/util/time.h
##########
@@ -34,16 +34,8 @@ enum DivideOrMultiply {
 };
 
 // TimestampType -> TimestampType
-static std::pair<DivideOrMultiply, int64_t> kTimestampConversionTable[4][4] = {
-    // TimestampType::SECOND
-    {{MULTIPLY, 1}, {MULTIPLY, 1000}, {MULTIPLY, 1000000}, {MULTIPLY, 1000000000}},
-    // TimestampType::MILLI
-    {{DIVIDE, 1000}, {MULTIPLY, 1}, {MULTIPLY, 1000}, {MULTIPLY, 1000000}},
-    // TimestampType::MICRO
-    {{DIVIDE, 1000000}, {DIVIDE, 1000}, {MULTIPLY, 1}, {MULTIPLY, 1000}},
-    // TimestampType::NANO
-    {{DIVIDE, 1000000000}, {DIVIDE, 1000000}, {DIVIDE, 1000}, {MULTIPLY, 1}},
-};
+ARROW_EXPORT extern const std::pair<DivideOrMultiply, int64_t>
+    kTimestampConversionTable[4][4];

Review comment:
       The problem here is that the compiler won't be able to optimize divide-by-constant, which is very slow by default.




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