For you
r convenien
ce to read and review, we
've separated them to single patches.
The first one (
custom_m...@trunk.diff) is the integration of a faster random() method. It's from
http://www.javamex.com/tutorials/random_numbers/xorshift.shtml. It
s time cost is 1/2
the time required by Math.random().
This patch also includes the optimiz
ation that if maxValue equals minValue
,then
there is no need to calculate the random value between them.
The second one (
layer_adding_obj...@trunk.diff) is to fix
the logic when adding objects to
Layer.
The third one is
a performance optimization for
the particle system (
emitter_performanc...@trunk.diff). Basically
, we add
ed a
Particle pool
for reus
ing Particle objects in order to reduce
any chopp
iness from object deallocation.
We override updateVertexBuffer() in Particle.java to do nothing
, since it's
a very time consuming operation
, while
it seems it's ok
if it do
es nothing
here. Also
we included some fixes
derived from some tips from google. In our game we're generating 60 particles per-second, and after applying this patch, our fps increased by 15+.