LibreOffice / loeclipse

LibreOffice Eclipse plugin for extension development
https://libreoffice.github.io/loeclipse/
31 stars 25 forks source link

Enhancing Node Path Manipulation Efficiency using += in OpenOfficeConfiguration.java #109

Closed Tharanishwaran closed 7 months ago

Tharanishwaran commented 7 months ago

The original code nodePath = "/" + nodePath; creates a new string object by concatenating the '/' character with the original value of nodePath. This operation involves allocating memory for the new string object and copying the characters of the original nodePath string.

On the other hand, the optimized code nodePath += "/"; directly modifies the original nodePath string, avoiding the creation of a new string object. This approach is more efficient as it reduces memory allocation and character copying operations.