-
Notifications
You must be signed in to change notification settings - Fork 871
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
In place comparison of serializable values. #1826
Comments
This idea is VERY VERY cool! |
Forgot to mention if we read bytes one by one to compare from direct memory it will not be fast but we can use memcmp which is standard C library which exist on all platforms like tens years already, this approach will provide good speed. The main bottleneck now for indexes is serialization speed. It should be as fast as possible. |
Is memcmp available as JNA API? |
It is one line of code. On Sat, Nov 16, 2013 at 9:49 AM, Luca Garulli notifications@github.comwrote:
Best regards, Orient Technologies |
Actually 4 lines. public static native int memcmp(long str1, long str2, long len); static { |
Cool |
Sorry guys no luck here call overhead eats everything. Actually I have doubts when created this issue too (spent several days thinking whether to create this issue or not ))) ) May be will come up with more nice idea about in place comparison later. Good that I did benchmark on prototype. |
Si it's cheaper to call the Java comparison than C ? What's the cost? However you could avoid serialization and do the same using Java, couldn't it?. |
It is very slow if you compare data byte by byte it is 1/4 slower, if you do in place comparison we need to copy array do native call and as result we have the same performance. |
Actually you are right, binary comparison in Java may be faster. I will reopen it and try after #856 . It may be faster. Need to try it. |
It matters of 3 hours to test it. not a lot of time. |
Good! |
We supported this in new binary serialization. Where was you referring in the code for this issue? |
do not think that we refer to the same approach, do you mean that comparison string lets say "adf" in binary form with "sdf" will have return the same comparison result , as if they are compared in lexicographical order, do not you ? |
When you need to unmarshall a field, it's unmarshalled the field name and passed to the compare, but it does byte-per-byte comparison avoiding to unmarshall the entire key before the comparison. |
It is related to indexes, but any way, it can be reused. On Fri, Aug 29, 2014 at 3:15 PM, Luca Garulli notifications@github.com
Best regards, Orient Technologies |
@tglman started this, he's better to answer. |
All dipends on the way data is serialized, so depends also on the types! If you know already some issue for this let's take note :) |
Optional for 3.0 |
Not actual any more |
Now when we compare keys in indexes we do following:
String keys can be relatively big but to compare them we often need very small piece of them. So following is proposed:
The text was updated successfully, but these errors were encountered: