开发者

Faster to generate thumbnail and write to response in Handler or generate in Http module and let IIS handler the rest?

What will be faster:

  • Generate a thumbnail then write the stream to the Http response using an Http Handler.
  • Generate a thumbnail in a http module on one of the earliest events and let IIS handle the rest of the request.

Tha开发者_Python百科nks, Ash.


Any answer you get here is likely to be an answer to the question "what SHOULD be faster" not "What IS faster".

To determine what is faster, you should try some performance tests. Try both methods, and use some app that will call them repeatedly, and see which is faster.


If you are interested in how to return an image from MVC and some perf tests I ran against it, I have an answer to a question on returning images from MVC. I did not test HTTP modules.

My results were:

  • MVC: 7.6 milliseconds per photo
  • Static: 6.7 milliseconds per photo
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜