Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Does the Java compiler optimize an unnecessary ternary operator?

JavaCard Applet Development Related Questions and Answers.
kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Does the Java compiler optimize an unnecessary ternary operator?

Post by kuafu » Mon Jul 08, 2019 3:48 am

https://stackoverflow.com/questions/544 ... y-operator
The simple answer is no. The java compiler doesn't care.
Most of the optimization are not done in the Java compiler but in the Runtime. Is your target performance results or performance result without runtime optimizations
But all the javacard rumtime didn't support JIT,didn't support javacard bytecode optimization. So we need a bytecode optimize to help us .
JCIDE will integration Proguard to help you.

You are aware of Proguard? http://proguard.sourceforge.net/
This is a great bytecode optimizer which implements a lot of optimizations. See the FAQ for a list:
Evaluate constant expressions.
Remove unnecessary field accesses and method calls.
Remove unnecessary branches.
Remove unnecessary comparisons and instanceof tests.
Remove unused code blocks.
Merge identical code blocks.
Reduce variable allocation.
Remove write-only fields and unused method parameters.
Inline constant fields, method parameters, and return values.
Inline methods that are short or only called once.
Simplify tail recursion calls.
Merge classes and interfaces.
Make methods private, static, and final when possible.
Make classes static and final when possible.
Replace interfaces that have single implementations.
Perform over 200 peephole optimizations, like replacing ...*2 by ...<<1.
Optionally remove logging code.
I'm sure you can further look into the source code to understand how they are implemented.
well

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: Does the Java compiler optimize an unnecessary ternary operator?

Post by kuafu » Wed Jul 10, 2019 10:24 pm

Hi guys .JCIDE can help you to solve the problem.
https://javacardos.com/javacardforum/vi ... 6050#p6050
well

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: Google [Bot] and 41 guests

JavaCard OS : Disclaimer