google / google-authenticator

Open source version of Google Authenticator (except the Android app)
Apache License 2.0
5.19k stars 966 forks source link

Concatenates strings in a loop #676

Open QiAnXinCodeSafe opened 5 years ago

QiAnXinCodeSafe commented 5 years ago

String objects are immutable. Concatenation and modification of string objects will eventually create a new string object.Concatenating strings in a loop creates a lot of objects and wastes the system's running time and space.You can use StringBuffer or StringBuilder instead of String for splicing

https://github.com/google/google-authenticator/blob/0e8cc0a3bcada1f8f35191bd0f9f95403da65ffc/mobile/blackberry/src/com/google/authenticator/blackberry/PasscodeGenerator.java#L102-L105

ThomasHabets commented 5 years ago

Thanks.

I doubt this'll be fixed, since who has a Blackberry in 2019?