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 6816817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:58:16+00:00 2026-05-26T20:58:16+00:00

Some time ago declarations like the following were defined by poor performance: var a

  • 0

Some time ago declarations like the following were defined by poor performance:

var a = "my" +
"very" +
"very" +
"long" +
"string" +
"and" + 
"even" +
"longer";

I was told that every subsequent + operation causes an additional string to be created since they are immutable. At least, once that was an issue in Java programming language (mind StringBuffer vs. String).

I am talking about the more-or-less recent versions of the browsers of course.

The question is about JavaScript now: is it still not recommended or the runtime can squack (or should I say optimize) the issue like one above in milliseconds without any performance overhead?

  • 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-26T20:58:17+00:00Added an answer on May 26, 2026 at 8:58 pm

    A number of points:

    • What you cite was never a performance problem in Java; the compiler always optimized it using StringBuffer. Problems only arise when appending to a variable in a loop.
    • Java and JavaScript have absolutely nothing to do with each other.
    • The JavaScript runtime would have to work very hard to de-optimize the issue until it takes milliseconds. On a modern CPU, a millisecond is an eternity.
    • Premature optimization. Don’t.
    • Profile/Benchmark before you optimize. Here’s numbers from someone who did, but note that the results are 3 years old and thus meaningless.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some time ago, people here helped me very well with code. Now I'm tasked
Some time ago I've written a Wa-Tor like cellular automata ( see Wikipedia )
Some time ago I installed my PFX key into Container using command like this:
Some time ago I used the regular method of loading Google Maps API like
Some time ago I read following rules: local variables, parameters are written with Camel
Some time ago (like 3 or 4 years) I heard about ability to generate
Some time ago I got this error when building ANY Visual Studio Deployment project.
Some time ago I put together a time based library that could be used
Some time ago I wrote a little piece of code to ask about on
some time ago I found an article ( Roles: Composable Units of Object Behavior

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.