Results 1 to 7 of 7

Thread: VB.NET vs PHP 4

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    2

    VB.NET vs PHP 4

    I thought VB.NET should be a lot faster than PHP because

    1. PHP is a scripting language and everytime it is run, it need to be compile and thus take longer time. Although .NET is not fully compile (like Java), but I think it should be faster than PHP.

    2. PHP is weakly type, which mean a variable is equilvalent to the 'object' variable in .NET where it can store anything without the need to define it/declare it to a specific type. So it should run slower then .NET because a lot of casting (i.e. checking variable type) is being perform.

    BUT ...

    I used to use PHP to read my raw log files and generate stats. Now I am trying the same with VB.NET. The log is around 100MB In both programming language,

    1. I read the log line by line
    2. Split each line into different parts
    3. And write a new file that meet my requirements (the shrinked log file)

    RESULT ...

    PHP completed the job in around 10 seconds.
    VB.NET take 30 seconds.

    -------------
    I can't believe this and I continue with part 2 of my work. I generate stats from my *shrinked* version of log file.
    ------------

    RESULTS...

    PHP takes merely 2 seconds.
    VB.NET take around 20 seconds.

    DISCUSSION...

    I believe the reason of .NET is slower because it utilise a lot of Objects, everything is Objects, string is objects, integer it objects, datetime is objects ... and objects are slow. And when dealing with hundred of thousands of objects (the log contains 160,000 lines), the time taken is noticeable.

    CONCLUSION ...

    Object Oriented Programming make programming easy but the the trade-off is TIME. It can't even challenge PHP directly stye programming.

    The reason I post this is to hear from opinions. Please voice it out loud!

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    My opinion isn't based on similar grounds as yours.

    I was skeptical earlier, but my opinion was changed after I realized that Enterprise Level web-applications can be created real easily with ASP.NET, something that would take much more time if we were using PHP.

    However, for personal sites, or sites that aren't too intensive, I'd prefer PHP.

    Feature-Rich ASPX pages are extremely large and heavy, and enterprise-users on a LAN would be fine with that, but not personal-users.

    Know what I mean?

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    perhaps your .net code is not optimized

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Originally posted by kleinma
    perhaps your .net code is not optimized
    My initial reaction as well...

    Remove integer-array bound checks in your build options.

    Only use System.IO classes, not the Vb6 compatability namespace functions for file operations.

    Also, VB.NET on IIS is JIT compiled on the first request (if session expired)... subsequent requests always run faster.

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by nemaroller
    My initial reaction as well...

    Remove integer-array bound checks in your build options.

    Only use System.IO classes, not the Vb6 compatability namespace functions for file operations.

    Also, VB.NET on IIS is JIT compiled on the first request (if session expired)... subsequent requests always run faster.
    Agreed.

    Also, post the .net code. I want to see what is taking it so long.

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    2
    To test it, I will try to have more similar code in PHP an VB.NET and will post the codes and result here.

  7. #7
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    yeah, run it 2nd time after compile, did you do it? maybe that's why it's so long
    \m/\m/

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