Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6941193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:51:14+00:00 2026-05-27T12:51:14+00:00

I was reading this documentation page, http://developer.android.com/reference/android/util/Log.html . The section here caught my eye:

  • 0

I was reading this documentation page, http://developer.android.com/reference/android/util/Log.html.

The section here caught my eye:

Tip: Don’t forget that when you make a call like

Log.v(TAG, "index=" + i);

that when you’re building the string to pass into Log.d, the compiler
uses a StringBuilder and at least three allocations occur: the
StringBuilder itself, the buffer, and the String object.
Realistically, there is also another buffer allocation and copy, and
even more pressure on the gc. That means that if your log message is
filtered out, you might be doing significant work and incurring
significant overhead.

This implies that the Android compiler is taking string concatenations (+) and converting them into StringBuilder and append statements.

Is my assumption correct or is it still better to use StringBuilder manually instead of string concatenation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:51:15+00:00Added an answer on May 27, 2026 at 12:51 pm

    The compiler does exactly what you suggest is implied. You can print the bytecodes of the generated .class file (using javap -c) and see the calls to construct and use a StringBuilder.

    However, it’s generally worth doing it manually when the string concatenations are spread over several lines of code. The compiler usually allocates a separate StringBuilder for every String-valued expression involving +.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading about using git as an svn client here: http://learn.github.com/p/git-svn.html That page suggests
Reading this page http://code.google.com/p/closure-stylesheets/ , I can't seem to find any documentation explaining how
I was reading over the documentation for query hints: http://msdn.microsoft.com/en-us/library/ms181714(SQL.90).aspx And noticed this: FAST
Reading PayPal developer documentation (and this is a lot of documentation) I'm not sure
http://php.net/glob The documentation page on glob() has this example: <?php foreach (glob("*.txt") as $filename)
I have a few questions about this after reading the iPhone documentation on it:
Reading the documentation it seems this might not be possible, but it seems that
I am trying to use the jQuery CSV plugin, as documented here: http://code.google.com/p/js-tables/wiki/CSV According
I'm new to cakephp...and I have a page with a url this: http://localhost/books/filteredByAuthor/John-Doe so
I was reading this blog post: http://www.shakie.co.uk/ramblings/feature-driven-development-riding-the-waves-of-change/ and came across the part about TestDox:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.