Hi Patrick,
Sorry for the late response. Can you clarify what you're looking to
optimize? Do you want tips on how to generate Java source or bytecode
that will run more efficiently on Avian, or how to improve the JIT
compiler in Avian so it generates better machine code from the
bytecode it is given? Or are you looking to make the JIT generate
machine code more quickly?
If it's the former and you're just looking to generate faster
bytecode, yes, inlining functions and unrolling loops might help (and
ProGuard might be able to do such things at the bytecode level). In
many cases, though, the bottleneck may be that the register allocator
in Avian's JIT is pretty dumb, so loop unrolling could actually slow
things down in some cases. If you're doing a lot of long arithmetic,
switching to ARM64 would probably be a win.
More generically, the key to successful optimization is to let a
profiler tell you where the bottlenecks are. You can write a simple
sample-based profiler in Java that spawns a separate thread which
samples the thread of interest e.g. 10-100 times per second by calling
Thread.getStackTrace() on it and adding the trace to a HashMap. Then
you can generate statistics from that HashMap, ranking traces by the
percentages of samples they appear in. That will tell you where your
program spends most of its time and thus what parts need optimization
the most. There are more sophisticated profilers available, of
course, but not all of them will run on Avian.
> --
> You received this message because you are subscribed to the Google Groups
> "Avian" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
avian+un...@googlegroups.com.
> To post to this group, send email to
av...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/avian.
> For more options, visit
https://groups.google.com/d/optout.