Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/16403#discussion_r93979106
--- Diff: common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java
---
@@ -119,7 +127,12 @@ public static void putFloat(Object object, long
offset, float value) {
}
public static double getDouble(Object object, long offset) {
- return _UNSAFE.getDouble(object, offset);
+ if ( null == _doubleBuffer) {
+ return _UNSAFE.getDouble(object, offset);
+ } else {
+ copyMemory(object, offset, _doubleBuffer.getBaseObject(),
_doubleBuffer.getBaseOffset(), 8);
+ return _UNSAFE.getDouble(_doubleBuffer.getBaseObject(),
_doubleBuffer.getBaseOffset());
--- End diff --
If `getLong()` never causes an alignment error, how about
Double.longBitsToDouble(_UNSAFE.getLong()).
While I am not familiar with ARM architecture, which one is faster?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]