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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:34:34+00:00 2026-05-24T07:34:34+00:00

I am rendering a map composed by 600+ SVG elements aligned in a cartesian

  • 0

I am rendering a map composed by 600+ SVG elements aligned in a cartesian plane. I need them to be separate elements because I want them to individually respond to mouse events, etc.

My question is: for the purpose of applying a lot of transformations like “translate” (changing their positions) for example, which option is “lighter” to browsers?

Rendering polygons like this hexagon:

<polygon points="43.301270189221924,55 43.301270189221924,65 51.96152422706631,70 60.6217782649107,65 60.6217782649107,55 51.96152422706631,50"></polygon>

… or creating them as paths like this one:

<path d="M43.301270189221924,55L43.301270189221924,65L51.96152422706631,70L60.6217782649107,65L60.6217782649107,55L51.96152422706631,50Z"></path>
  • 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-24T07:34:35+00:00Added an answer on May 24, 2026 at 7:34 am

    I doubt there’s going to be much difference, but if there is any, I’d expect polygon to be marginally faster, since it’s specifically meant for, you know, polygons.

    In fact, after running two profiling scripts (see below), my above assessment appears correct. Polygons are a little bit faster than paths in all browsers, but the difference is hardly significant. So I doubt you really need to worry about this. Luckily, polygon sounds like the logical choice anyway.

    Profiling path:

    <svg xmlns="http://www.w3.org/2000/svg">
        <g id="paths"></g>
    
        <text x="20" y="20" id="out"></text>
    
        <script><![CDATA[
        var d = "M43.301270189221924,55 L43.301270189221924,65 L51.96152422706631,70 L60.6217782649107,65 L60.6217782649107,55 L51.96152422706631,50 Z";
    
        var paths = document.getElementById('paths');
        var path = document.createElementNS("http://www.w3.org/2000/svg", 'path');
        path.setAttribute('d', d);
    
        var start = new Date();
        for (var i = 0; i < 20000; i++)
        {
            var el = path.cloneNode(true);
            el.setAttribute('transform', 'translate(' + ((i * 20) % 1000) + ',' + ((i / 50) * 20) + ')');
            paths.appendChild(el);
        }
    
        setTimeout(function() {
            document.getElementById('out').textContent += 'Path: ' + (new Date() - start) + 'ms';
            // paths.parentNode.removeChild(paths);
        }, 10);
    
        ]]>
        </script>
    </svg>
    

    And the same thing for polygon:

    <svg xmlns="http://www.w3.org/2000/svg">
        <g id="polygons"></g>
    
        <text x="20" y="20" id="out"></text>
    
        <script><![CDATA[
        var points = "43.301270189221924,55 43.301270189221924,65 51.96152422706631,70 60.6217782649107,65 60.6217782649107,55 51.96152422706631,50";
    
        var polygons = document.getElementById('polygons');
        var polygon = document.createElementNS("http://www.w3.org/2000/svg", 'polygon');
        polygon.setAttribute('points', points);
    
        var start = new Date();
        for (var i = 0; i < 20000; i++)
        {
            var el = polygon.cloneNode(true);
            el.setAttribute('transform', 'translate(' + ((i * 20) % 1000) + ',' + ((i / 50) * 20) + ')');
            polygons.appendChild(el);
        }
    
        setTimeout(function(){
            document.getElementById('out').textContent += 'Polygons: ' + (new Date() - start) + 'ms';
            // polygons.parentNode.removeChild(polygons);
        }, 10);
    
        ]]>
        </script>
    </svg>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bit of a weird one this. I'm rendering datasets on a map and need
I'm working on a multi-threaded win32 MFC application. We are rendering a map and
I am rendering a rails partial and I want to alternate the background color
i have 3 shapefile ready in a map file, and rendering it on mapserver.
Hi I am rendering a map using setDataURL(path to map xml), currently when I
I am having trouble rendering a google map infowindow anchored with multiple markers. I
I've got my map mostly rendering, but I keep getting an error in firebug
I have a page where I want to display some points on map. I
I want to databind an ItemsCollection, but instead of rendering the collection items, I
I have a google map inside a div that I need to be hidden

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.