1

As far as I know, there are two (or in some senses three) ways of inserting a picture in a post.

  • Using the built-in image button or its equivalent by writing ![ ]( )
  • Using the HTML code <img>

Now, clearly using the HTML code will give more versatile options as width and height. But my question is: which of these methods is more efficient, regarding the amount of processing which has to be done on the server to preview the pictures? Or maybe they are absolutely equivalent?

Does this apply for all SE sites as well?

The total amount of process in both view and preview would be a better measure of efficiency. Also since there are thousands of questions asked everyday, even a tiny bit of energy which could be saved might become important. I would be glad if someone can give me some real numbers, so I can estimate the difference.

1
  • 1
    The difference is probably so small as to be difficult to measure, and irrelevant. But if somebody wants to benchmark, they're both handled by different parts of Stack Exchange's open source MarkdownSharp library.
    – Jeremy
    May 28, 2013 at 22:25

2 Answers 2

5

It is synthetic sugar in my opinion. For example,

![](http://www.gravatar.com/avatar/c5c9e41fad004af8e95ae66304da5d94?s=32&d=identicon&r=PG)

is translated via simple JavaScript to (in the Preview section):

<img src="http://www.gravatar.com/avatar/c5c9e41fad004af8e95ae66304da5d94?s=32&d=identicon&r=PG" alt title />

So I would go with "absolutely equivalent", or at least such a minor difference that it doesn't matter. Just use whatever you feel more comfortable with.

6
  • 2
    While I agree that it's practically equivalent, your post is a bit misleading: it reads as though the Markdown is typically rendered in JavaScript, but that's only the case for previews.
    – Jeremy
    May 28, 2013 at 22:26
  • 1
    @JeremyBanks well, he asked "regarding the amount of process which has to be done on the server to preview the pictures" but yeah, will edit to make it clear. May 28, 2013 at 22:40
  • 1
    For non-previews the rendered HTML is cached anyway, so it still won't make any noticeable difference.
    – hammar
    May 28, 2013 at 22:41
  • @ShaWizDowArd Pardon, I read that as "to view".
    – Jeremy
    May 28, 2013 at 22:44
  • synthetic sugar? Do you mean syntactic sugar?
    – PM 2Ring
    Jul 4, 2021 at 13:53
  • @PM2Ring lol yes, it was over 8 years ago I was young and clueless back then. ;) Jul 4, 2021 at 18:33
2

Both of them will have the same performance. The final result you see as a post is the rendered and cached HTML page. So, if you used the Markdown format for your images, those will be changed to HTML (server/client-side; need reference) and then stored.

As far as displaying the pictures is concerned, that is solely dependent on the client connection and the server doesn't play any role there.

Not the answer you're looking for? Browse other questions tagged .