Results 1 to 17 of 17

Thread: Is VB.Net really as slow as this...?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23

    Is VB.Net really as slow as this...?

    okay,

    as some may have noticed, i started the thread on performance timers... which is now sorted. But having got it sorted, my time comparisons are a little *bad* as you can see:

    okay, first up - test machine:
    700mhz Athlon Thunderbird / 288mb PC100 RAM (ie, not slow!)

    I'm testing the maths/memory manipulation type things w.r.t. using VB.Net for high performance (okay, i know it aint top-of-the-line) multimedia/graphics work... thus speed is critical.

    here are my results:

    MATHS FUNCTIONS:
    in order: sqrt, sin, arccos, arctan
    (times in nanoseconds)

    VB6 | VB.Net | VB.Net is...
    =======================================
    281.8882 | 630.0195 | 123.5% slower
    265.1841 | 665.9771 | 151.14% slower
    883.1846 | 1041.6985 | 17.95% slower
    326.3383 | 927.4561 | 184.2% slower

    MEMORY MANIPULATION:
    in order: alpha blend test, memory addition
    (times in milliseconds)

    VB6 | VB.Net | VB.Net is...
    ======================================
    20.7814 | 80.5359 | 287.54% slower
    104.9186 | 155.8228 | 48.52% slower

    okay, the VB6 code and VB.Net code is pretty much identical (as much as is possible). VB6 code is using the most optimized native compile as possible (for speed). VB.Net is just set to the "release" configuration and run through windows (not with debugger attached)...

    Please tell me I'm missing something really obvious with respect to speed-compiling a VB.Net program - these results are awful! IT HAS TO BE MY FAULT!!!

    can someone give me good reason to kick myself and make VB.Net run a little bit faster

    Jack;

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23
    should anyone want to double-check my code/methods:
    http://www.vbexplorer.com/directx4vb...erformance.zip(31kb)

    is the code (VB6 and .Net) that i used.

    Jack;

  3. #3
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Is this running out of the IDE or compiled? Benchmark the exe, not a debugger.
    Please rate my post.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23
    VB.Net is just set to the "release" configuration and run through windows (not with debugger attached)...
    - from my first post.

    unless there is something wrong with "building" the solution using the release configuration, closing VS.Net and navigating to the correct folder and running from there - then this is from compiled .EXE times!

    read the post next time

    Jack;

  5. #5
    Lively Member Radar's Avatar
    Join Date
    Apr 2001
    Posts
    70
    Jack, your methods look okay to me. I didn't time it as you have, but I am running VS.NET on a pIII/1Ghz/128mb/Win2k pro machine, and it seems to me that my VB.NET compiled programs are MUCH slower than their VB6 counterparts. If you need backward compatability with slower computers, you're probably pretty much screwed
    Aww screw it. I didn't really want to fool with it anymore anyhow.

  6. #6
    Addicted Member donut's Avatar
    Join Date
    Mar 2001
    Location
    London, UK
    Posts
    165
    that's quite worrying! i thought VB was now meant to be on par with C++...

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23
    Whilst it's worrying how slow VB.Net is, i'm reassured that it's not just me whos noticed it thanks people!

    As for VB being on a par to C++, it probably is but only when you make .Net applications in C++ (managed code libraries/web programs etc...) - in which case both languages are compiled down to the same MSIL code, thus any speed difference is likely to be negligable / down to the programmers "style"...

    Mentioning C++, it seems that VC++.Net is slower than VC++6 as well, which means that then general across-the-board results is that .Net is plain slower... I later read a review and found out that VC++.Net tends to compile code to the MSIL standard (uses the general compiler) and it just has a special extended program to make it a "native" Win32 .EXE, basically it does the runtime/JIT compiling before hand... thus I'd guess that it's loosing some speed through the MSIL stage in compilation.... oh well

    Jack;

  8. #8
    Lively Member
    Join Date
    Aug 1999
    Location
    Amsterdam
    Posts
    117
    All Managed code gets compiled to MSIL, including Managed C++. You probably mean NGen.exe by "special extended program", NGen indeed compiles the MSIL code to x86 code. This is obviously not only for C++, NGen doesn't even know from which language the MSIL was generated (VB or C# etc.).

    The first time when you invoke a method of a Managed App (without NGen'd before) is always slower because it has to be JITed first.

    Are you perf results the same when you run the test a couple of times, without closing the App ??

    And how is perf when you NGen your App first ??

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23
    I haven't seen this "NGen.exe" yet, so I'll have a look into it... thanks for pointing it out..

    Is there info in the help libraries about it? or do you have to work it our yourself?

    As for the JIT'ing / running the tests several times - I set the program to do 100 loops for each test (thus, if it's cached the JITed code it may speed up), however, I did get a slight speed increase - but nothing worth talking about, and it only kicked in after 2-3 executions, and didn't improve after that (it went from ~630 -> ~600 nanoseconds)...

    Jack;

  10. #10
    Member
    Join Date
    Mar 2002
    Posts
    40
    Can someone please tell me where this "NGen.exe" is located?

    Thanks. Lance

  11. #11
    Lively Member
    Join Date
    Aug 1999
    Location
    Amsterdam
    Posts
    117
    c:\<WindowsDirectory>\Microsoft.NET\Framework\<Version>

    For example:

    C:\WINDOWS\Microsoft.NET\Framework\v1.0.3423



    Or launch the "Visual Studio Command Prompt" from the menu and run ngen from the commandline: ngen <enter>

  12. #12
    Jethro
    Guest
    What version of Windows you got on there, pre- Win2K slows everything down

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23
    tested on a Win98 system, but developed on a WinXP system - the times quoted are from the XP system....

    anyway, if it's really slow on 98 (one of the most widely used OS's still) then thats still points against. I only assume that people are upto Win98 or above, I only wont support Win95 (it sucks now)..

    Jack;

  14. #14
    New Member
    Join Date
    Apr 2002
    Posts
    4
    I read an article from Eweek on database benchmarking. They tested MySQL, Oracle, all the big hitters. Well, they said that a combo of MS SQL, ASP.net using VB.net, and IIS 5.0 served up 873 pages per minute.

    Since ASP.net has to go through the JIT compiler, since its not pre-compiled, thats gotta be slower than pure VB.net. Therefore, i'm guessing that VB.net still has performance advantages. BTW, the StringBuilder class is much faster than the String class
    << IF YOU WORK FOR MICROSOFT OR KNOW WHAT YOUR TALKING ABOUT, I LOVE YOU >>

  15. #15
    hellswraith
    Guest
    Since ASP.net has to go through the JIT compiler, since its not pre-compiled
    From what I understand, it only goes through the JIT once, the first time. After that, the compiled version is from then on used. ASP.Net code is compiled though. It runs pretty fast too.

  16. #16
    Thelonius
    Guest
    Can you check your link. I'm getting a page not found when I try to download your code.

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    England
    Posts
    23
    hmm, I'll sort it out later - the file isn't there due to the recent move from the VBExplorer.com server (now dead) to the Planet-Source-Code.com / Exhedra.com Server (my new home)...

    Jack;

Posting Permissions

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



Click Here to Expand Forum to Full Width