DEV Community

Raghavendra
Raghavendra

Posted on

PNG vs SVG for Logos and Icons

In most of the applications, Icons will appear after a delay of 1 to 2 seconds. This is bad for the User Experience. There are multiple ways to improve the performance of icon rendering.
The streategies are

  • Using CDN
    • Reduces the network latency in fetching the image. Still there can be a latency for first load or less frequently used images
  • Using Sprite and CSS
    • All icons are loaded in one image so there will be a delay till the sprite image is loaded for the first time
  • SVG embedded into HTML
    • SVG can be embedded into HTML. This eliminates the extra fetch for the image.
    • In many cases the size of the SVG is smaller comparable to other image formats
    • The latency issue is still persist if SVG is loaded as a separate image file

Here is the example I tried to load the Logos and icons in different formats. Embedded SVG is loaded as part of HTML while the other formats loads after a delay.

Example of SVG Image Performance

The source code is at https://github.com/sodaru/icon-performance-demo

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay