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

  • Home
  • SEARCH
  • 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 8886581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:35:32+00:00 2026-06-14T21:35:32+00:00

I have some cases in my code where I am building a large string

  • 0

I have some cases in my code where I am building a large string of text, such as a complex SQL statement. I intend to put this text together many times in a row, each with some slightly different parameters. I’ve come to the habit of using a subroutine named just procedure A(const S: String); which simply appends the text (S) to the larger string Text := Text + S + #10 + #13;

I was wondering if this could hinder the performance as opposed to using traditional string concatenation? I am beginning to think the compiler optimizes something like this:

Text := 'some' + ' ' + 'text' + ' ' + 'and' + ' ' + 'such';

to

Text := 'some text and such';

Is this true? Does the compiler optimize this scenario? If so, I may decide to change everything to something like this:

Text := 'select something from sometable st'+#10+#13+
  'join someothertable sot on sot.id = st.sotid'+#10+#13+
  'where sot.somevalue = 1'+#10+#13+
  'order by sot.sorting';

Would this be faster theoretically than

Text:= Text + 'select something from sometable st'+#10+#13;
Text:= Text + 'join someothertable sot on sot.id = st.sotid'+#10+#13;
Text:= Text + 'where sot.somevalue = 1'+#10+#13;
Text:= Text + 'order by sot.sorting';

or how I usually do it:

A('select something from sometable st');
A('join someothertable sot on sot.id = st.sotid');
A('where sot.somevalue = 1');
A('order by sot.sorting');
  • 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-06-14T21:35:33+00:00Added an answer on June 14, 2026 at 9:35 pm

    An expression like

    'a' + 'b'
    

    is evaluated at compile time. Which means that an assignment

    str := 'a' + 'b';
    

    results in identical compiled code to

    str := 'ab';
    

    On the other hand, for

    str := 'a';
    str := str + 'b';
    

    the concatenation is performed at runtime.

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

Sidebar

Related Questions

This is a minimal test case of some code that I actually have. It
I had some existing VBA code that was building queries using string concatenation. I
Could I have some feedback on this Given new House(x ) sends a string
I have some code that causes the box2d physics simulation to stutter forever after
I have some test cases. The test cases rely on data which takes time
I have a problem where in some cases (appears to be where property type
I have a checkbox which in some cases may be disabled and checked using
I need to have a formula produce a null in some cases, numeric in
I am using jquery cluetip and i have noticed taht in some cases the
I have a 404.html page, but in some cases I want to be able

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.