[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

(asp.net) un-managed code

Posted on 2008-06-10
8
Medium Priority
?
190 Views
Last Modified: 2010-04-15
I'm working on a asp.net app that's eCommerece. I downloaded a dotnet profiler and ran the app.

The bottleneck shows at an ASHX page and there's a routine in there. It calls database stuff.

But my question is, howcome this is unmanaged code and is unmanaged code bad? ** the profler shows this functon as unmanaged**

This is the code below:


using System;
using System.Web;
using System.Web.UI;
 
using System.Diagnostics;
 
 
using DX.Catalog;
 
 
    public class CategoryUrl : IHttpHandler, System.Web.SessionState.IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            
 
            string destinationPage = "~/ListProdcuts.aspx";
 
   
 
            if (string.IsNullOrEmpty(context.Request.QueryString["Tail"]))
            {
                Category category = Category.GetById(new Guid(context.Request.QueryString["CategoryId"]), true);
                string landingPage = "~/Categs/" + category.TreePath.Replace("/", ".") + ".aspx";
 
                if (System.IO.File.Exists(context.Server.MapPath(landingPage)))
                {
                    destinationPage = landingPage;
                }
            }
 
            context.RewritePath(destinationPage, context.Request.PathInfo, context.Request.Url.Query.TrimStart('?'), false);
 
            IHttpHandler page = PageParser.GetCompiledPageInstance(destinationPage, context.Server.MapPath(destinationPage), context);
            page.ProcessRequest(context);
        }
 
        public bool IsReuse
        {
            get
            {
                return true;
            }
        }
    }

Open in new window

0
Comment
Question by:Camillia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 21752724
Any .Net code you write is managed code, however, you can make calls to unmanaged code.  My guess is some of these methods which you haven't posted more detail on make calls to unmanaged methods, specifically the category object.

0
 
LVL 7

Author Comment

by:Camillia
ID: 21752830
ah, so I need to trace that category object? so this ASHX itself is managed but it calls other methods that are unmanaged...

unmanaged code is bad for performance?
0
 
LVL 33

Accepted Solution

by:
raterus earned 2000 total points
ID: 21752876
Unmanaged code is not bad, it just doesn't run under the .Net CLR (aka. Virtual Machine).  Unmanaged code talks directly to the computers processor, while .Net (managed) code talks to the CLR, which talks to the computer's processor.  Technically, unmanaged code has the potential to run more efficiently than .Net code since there isn't this intermediate step :-)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:Camillia
ID: 21752944
thanks...makes sense. I will need to look at this bottleneck. Have you used MyGeneration database wrapper...they use it a lot in this app..maybe that's an issue...but good to know I can rule some things out.
0
 
LVL 33

Expert Comment

by:raterus
ID: 21752973
Sorry, not familiar with that one :-)
0
 
LVL 7

Author Comment

by:Camillia
ID: 21753417
thanks for your help. Will leave this open for now and see if anyone has anything else to add.
0
 
LVL 7

Author Comment

by:Camillia
ID: 21754772
You're right , something's going on with that Category object.

Let me ask you this and then I will close question.

The profiler shows that that object consumes 212,206 byes of memory. Total byte allocated for this object is 244,392 bytes That's not good, is it? dont think it is ..
0
 
LVL 33

Expert Comment

by:raterus
ID: 21754925
Probably out of my expertise as far as a solid answer, but I do know a program can request a large amount of memory to be reserved for it's execution, memory it may never use.  This might help explain your memory discrepancy.

I really only remember reading this once when I looked up virtual memory, wondering why it's even needed these days.  Seems windows is smart and offloads this reserved memory to a hard-disk until it's actually used in the program.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question