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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:03:13+00:00 2026-05-17T22:03:13+00:00

I have about 10 standard blocks of dynamically generated HTML that get included on

  • 0

I have about 10 standard blocks of dynamically generated HTML that get included on a large percentage of pages on my site (informational sidebars).

I can use #include statements or define them as a macros, both would work.

What’s better? I’m new to Velocity and migrating a site from JSP.

Why use one vs the other? Why have #include when a no-arg macro() does the same? Are they handled any differently from a caching/memory perspective?

  • 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-17T22:03:14+00:00Added an answer on May 17, 2026 at 10:03 pm

    If they are static blocks (no VTL code in them), then #include-ing them as separate resources will certainly perform much better. Even if they are dynamic (have VTL code), then you can use #parse instead of #include and still get better performance than a macro. I wouldn’t even be surprised to learn that #define VTL blocks are faster than macros, though i haven’t tested that. Macros are great and very useful, but people do sometimes misuse or abuse them.

    The downside of #parse and #include is that you have to maintain more separate files, but that’s the price for superior speed. #define is great for code blocks that don’t need args and/or need to be passed around as a reference, but you should only use #define’d blocks directly in the template that defines them or things can get confusing.

    Macros are great in that they take params and can be defined globally, and globally is where they perform best and make most sense. I generally try to avoid local macros when i have a reasonable alternative. And when i successfully avoid having any local macros, i turn support for them off to get a small speed boost.

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

Sidebar

Related Questions

I have about 200 Excel files that are in standard Excel 2003 format. I
I have a couple questions about Ruby's methods, procedures, and blocks that strike me
I have an existing application that has some parts of formatted text-blocks (standard formats
I have a question about forms. I have a fairly standard form that saves
I have about 10million values that I need to put in some type of
So I have about 10 short css files that I use with mvc app.
I have a Server 2003 box with about 6 sites that each have about
I am looking at the performance suggestions lots of pages have about asp.net. Specifically
I have a few related questions about managing aligned memory blocks. Cross-platform answers would
I'm wondering about standards or commonalities for various common elements on webpages that have

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.