0
\$\begingroup\$

I wanted to create a portal. This portal looks like a semi-transparent texture rotating on a cylinder:

enter image description here

At first I created such a portal using a Particle System.

Then I realized that this might be an overkill and built another portal the following way:

I put a cylinder in the scene, put the texture on it and added a script that would rotate the cylinder.

The visual result of the 2 approaches (Particle System vs. Mesh approach) is perfectly the same.

Now I wanted to test which one performs better.

Am I right to assume that I should write a script which creates 10.000 portals of type A or B in the scene and have a look at some statistics (not sure yet which / where to find them), or is there anything more convinient to test performance?

Thank you!

\$\endgroup\$
1
  • \$\begingroup\$ Will you ever need 10 000 portals in one scene? If not, a performance difference that only shows up when there are 10 000 is probably too small to actually matter. Don't get caught up in micro-optimizations: if either style works adequately for your needs and isn't causing a performance issue you can already see in the profiler, then just use the one that you like working with best and move on to your next feature. \$\endgroup\$
    – DMGregory
    Apr 17, 2019 at 21:29

1 Answer 1

3
\$\begingroup\$

Ideally the way you compare performance is to profile (with the appropriate tools, in this case probably both CPU and GPU-based profiling tools that may be available to you) the actual scenarios you're considering between, and compare the results.

There's a good chance that the impact either approach has on performance is so small, in this case, that it will be negligible within the larger actual scenario you're rendering. In those scenarios, it is typical to try to artificially increase the scale of the scenario to make the differences more pronounced -- in other words, to try to render tens of thousands of objects using both techniques and look at them side-by-side.

While this can help make the difference in techniques more pronounced, it can also make it seem more significant than it is. If tens of thousands of portals is a scenario you might expect to actually encounter in your game, by all means, profile for it. But if it's not, consider that perhaps all you need to do is determine if your technique is good enough at the expected scale of only tens (say) of portals in the scene.

As DMGregory said in the comments, don't get caught up in chasing micro-optimizations.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .