Is it worth striving to minimize the number of characters in identifiers and resource names in order to increase speed and reduce memory footprint?

Here is an example of the names of lines from the longest, but understandable, to short, but requiring to think about what it means:

  • string name="menu_item_set_everyday_tasks"
  • string name="menui_set_everyday_tasks"
  • string name="menui_seteverydaytasks"
  • string name="menui_setevrdtasks"
  • string name="setevrdtasks"
  • string name="setevrdtsks"

Of course, this discussion is significant when we have in the same application about a few hundred IDs, string resources, etc.

  • 2
    speed of this will not increase, the memory - slightly. It makes sense to use special minimizers (the simplest is proguard). But the code must have clear names, otherwise in half a year it will be possible to look at the names a / b / c for a long time ... - pavel

2 answers 2

No no need.
XML resource files do not fall into the compiled code in its pure form. Instead, the development environment automatically converts string names into numeric identifiers and places them as static numeric constants in the R.java class. And numeric variables, as is known, occupy a fixed number of bytes.

For more details, for example, here: http://developer.alexanderklimov.ru/android/theory/resources.php#string

  • Is there any style code for XML like Google released for Java for Android? - Kostya Bakay
  • one
    @Kostya is something here: github.com/google/styleguide - JustAnotherCoder

Of course, this discussion is significant when we have in the same application about a few hundred IDs, string resources, etc.

Not worth it even in this case.