+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 1969
    Posts
    851

    Question Performance of switch in ASP.Net vs. decision structure in SQL

    Maximizing system performance, I generally prefer to employ all possible processing on db instead of web server.

    The C# code employs a 10-case switch to discern which sproc to call, and am wondering if a decision structure in a single sproc will offer a substantial performance increase (i.e. is the performance cost on the db "significantly" less than the performance cost on the web server).

    Any thoughts?

  2. #2
    Join Date
    Dec 1969
    Posts
    95,774

    Default

    Nope. I think you have it right.

    A switch() in C# code *HAS* to be faster than whatever you would replace it with in SQL.

    A C# switch( ) will execute in a couple of nanoseconds. You'd be amazed at how efficient a compiler can make a switch be. Especially if the switch values are contiguous integers. But it's pretty darned fast no matter what.

  3. #3
    Join Date
    Dec 1969
    Posts
    851

    Default

    Thx again.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


More ASP Resources

Resources:
-- ASP Articles
-- ASP.NET Information
-- 4Guys ASP F.A.Q.
-- ASPFAQs.com
-- ASP Coding Tips
-- Related Web Technologies
-- User Tips!!
-- ASP-related ListServs
-- HTML5 Development Center
-- JavaScripts


Smart Sites
-- Mobile Development Center
-- MSDN SpotLight
-- Web Dev Resource Center
-- Cloud Showcase for Developers


Windows Technology
Check out these Web sites for articles, tutorials, FAQs, discussions, and code on ASP and related technologies!
-- CodeGuru.com
-- VBForums.com
-- ASPFAQs.com
-- ASPMessageboard.com
-- DevX.com
-- Developer.com
-- FreeVBCode