-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add scala native support #730
Conversation
@sirthias I made a small local test to ensure that at least the basics work - for the rest i trust the existing automated tests. I also updated the ci.yml:
Also i commented the macrolizer dependencie in out, since it has no Scala Native support. I have no device running with BIG_ENDIAN, maybe someone should execute the tests with a device running on BIG_ENDIAN. |
In order to compile the native modules you may need to install the required dependencies for Scala Native on your machine. |
I will make some changes to the Unsafe.scala file to call more low-level functions and possibly improve performance. |
I looked at the reference provided by @plokhotnyuk in #633 (comment). The only change I made was to use a |
Thank you, @PhoenixmitX, for your contribution here and sorry for not chiming in earlier. |
def setOctaByteBigEndian(byteArray: Array[Byte], ix: Int, value: Long): Unit = | ||
_setOctaByteBigEndian(byteArray, ix, JLong.reverseBytes(value)) | ||
|
||
final class BigEndianByteArrayAccess extends UnsafeByteArrayAccess(ByteOrder.LITTLE_ENDIAN): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should extend UnsafeByteArrayAccess(ByteOrder.BIG_ENDIAN)
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you're correct, but I copied it from the Java implementation.
https://github.com/sirthias/borer/blob/master/core/.jvm/src/main/scala/io/bullet/borer/internal/Unsafe.scala#L293
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on my way home.
I will look deeper into it when I arrive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's wrong there as well.
This bug probably never got triggered so far since "direct JSON parsing" is so far only available on little endian platforms. This should be improved...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not in this PR though!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked a bit more into this topic and, to be honest, big endian appears to be pretty much dead regarding the commercial importance. There are almost no relevant big-endian-only platforms produced anymore.
Everything out there is either directly little endian oder at least bi-endian, which ends up being configured to almost exclusively run in little-endian mode.
So, since borer should work fine on big endian systems as it is I'd rather spare the work for any big-endian optimizations. In all likelihood they simply won't ever see production use anywhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean that we leave the big endian support untested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If yes, what else needs to be done to get this merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean that we leave the big endian support untested?
I've just created #731 for this.
Nothing big-endian related required in this PR.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If yes, what else needs to be done to get this merged?
Give me a bit more time to look at this PR and then I think we should be fine to merge.
Finally got around to properly looked at this. |
You're welcome 🤗 and thank you for merging this. When can we expect a release including the Scala nativ Support? |
I'm in the process of adding one more little feature (JSON pretty printing) and then I'll cut the next release. |
Ok, I just published version |
Attempt to add scala native support
TODOs:
closes #633