It only depends on the use cases faster. If you register static strings, itβs faster to just pass this constant and ignore it. Otherwise, if you create strings, you must create at least one object. The function objects are tiny and cheap β you'd better create one of them, except for the line, if you ignore it.
Personally, I believe that such an understanding of the principles of first-level compromises is even more valuable than a specific study of a particular application, which may have used one or the other, because it allows you to understand why you chose one or the other (and you still always want to compare your attachment).
(Note: how expensive the creation of the object depends on how much the garbage collector affects, as a rule, short objects can be created and deleted at a speed of the order of 10 8 per second, which should not cause concern, except for hard internal loops. in strict inner loops, I think something is wrong. Instead, you should write unit tests for this.)
Rex kerr
source share