[Biojava-l] [Biojava-dev] Port an Algorithm to Java
Amr AL-Hossary
amr_alhossary at hotmail.com
Thu Mar 29 04:14:29 UTC 2012
I don’t have a link to a website in my head right now,
but any way, here are some examples:
1- Never use variables less than 32 bit width if you are interested in performance:
consider that a and b are both short integers
statement like
a = a+b
is valid in C but not in Java;
because Java promotes all variables to 4 bytes before ANY operation (even comparative reading [non modifying] operations).
This way, both a & b will be promoted to int, and summed, then an explicit cast is required before being assigned back to the variable a.
All this overhead is not required in processing-oriented applications.
BTW although a= a+b won’t work , a+=b will work (because it includes an implicit casting operator)
2- Remember that all variables in java are signed (except for char which is equivalent to unsigned short in C)
and that variables in Java have different sizes than C
so comparing the literal 0xFFFF to the short variable a whose value is 0xFFFF won’t return true..try it. Did you get why?
to overcome this problem you will lose some of the performance too.
3- Remember that not all operators do the same action in Java like in C: revise the function of the >> operator in java versus C.
One final point:
my name is “Amr” not “Arn”.
Regards
Amr
From: Dragos-Bogdan Sima
Sent: Wednesday, March 28, 2012 7:05 AM
To: Amr AL-Hossary
Cc: Andreas Prlic ; Biojava ; Scooter Willis
Subject: Re: [Biojava-l] [Biojava-dev] Port an Algorithm to Java
Hello Dr. Andreas Prlic,
So basically I have to understand how the programs are working while overviewing the sources, so that I could explain in my aplication how I plan to port to Java?
And Arn, could you explain me a little bit more the cases where the PTM would be required or give me some usefull links, beside the wikipage, for study?
Thanks you,
Dragos.
More information about the Biojava-l
mailing list