The fight starts:-) P-code VS Native Code
Results 1 to 9 of 9

Thread: The fight starts:-) P-code VS Native Code

  1. #1
    Gbin@ryR
    Guest

    Post The fight starts:-) P-code VS Native Code

    Hello guys. I would like to now what the differences (advantages and disadvantages) between P-code and Native Code which i've seen in VB.
    Thankz

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    its my understanding P-code optimizes for the pentium instruction set.

    i never make anything large enough where i have to worry about it.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  3. #3
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    Posts
    1,408
    I thought that P-code used the VB6 dlls, whereas native code compiled everything into one executable file (or the other way round).
    Paul Waring - Web site design and development.

  4. #4
    Gbin@ryR
    Guest
    Thankz.

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    looks like i didn't understand it too well:

    http://www.vbsquare.com/php-bin/prin...iclepageid=774

    P-Code VS Native Code:
    One thing you might have noticed is that you can choose whether to compile your software as Native Code or P-Code (pseudocode). The default option is Native code and should be left like that.

    What is P-Code?
    When pressing the Start button in the Visual Basic IDE, the Visual Basic compiles each line into P-Code and interprets it. This is much faster than Native Code in the IDE circumstance. By choosing to compile your software into P-Code, Visual Basic will store that code into an EXE where it will be interpreted line by line for the rest of its life

    What is Native Code?
    Native Code came out with Visual Basic 6.0. Running Native code is much faster than running P-Code in an exe case. When compiling to Native Code, Visual Basic compiles your software into the instruction set of the processor chip on your system

    One thing I’ve noticed in Native Code, that unlike P-Code, it might give you strange bugs. Many of you might not have faced such a problem but I have. My code runs perfectly in the IDE as it runs P-Code. But after I compile it, I sometimes (very rarely) get strange errors. Most of them occur while unloading forms or some of them occur while displaying the Printer Dialog box over a modal form. I resolved these problems by putting the “DoEvents” statement in-between the code. I repeat, this happens only rarely and with some types of software.

    So what should you use? Leave it to Native Code.

    Optimize For Fast Code:
    This option is only available if you decide to compile your software to Native Code. This tries optimizing the code to make it faster but it might compile larger. This should remain checked.

    Optimize For Small Code:
    This isn’t recommended. This option is able to shrink the size of the software but by making it slower.

    No Optimization:
    The compiler will simply convert the P-Code to Native Code without any optimizations. Only recommended if you are constantly getting errors in your compiled software.

    Favor Pentium Pro:
    Although this isn’t the default option for the Native Code compiler, I always check it and would recommend you check it to. Favor Pentium Pro allows you to favor the Pentium Pro instruction set over the normal Pentium one. This could cause your software to run much faster on Pentium Pro and Pentium 2 + machines. Checking this does not mean that it will not run on other computers, it will just run a little slower. A risk I’m willing to take knowing many users use Pentium machines these days and not 486s.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  6. #6
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716

    Thumbs up

    Your computer only runs one kind of code,
    machine code.
    To run P code, it must interpret it at runtime,
    assuming you have the interpreter.
    An interpreted language is portable, if the interpreter
    has been ported to your architecture.
    A program written in machine code may be very
    short and efficient, but is not portable.

    There's a lot of overhead involved in the search
    for the "holy grail" of portability.
    That's why you have to have a pentium III
    to do the work that you used to be able to do
    on a 286
    I came in to the world with nothing. I still have most of it.

  7. #7
    Gbin@ryR
    Guest
    A book i have read, says that it's better to compile with P-code than Native Code, because it runs every part of the programme and it sees for errors.

  8. #8
    Junior Member
    Join Date
    Feb 2002
    Posts
    4
    P-code means "precompiled code" this type of code is interpreted by the VB dll's. if you compile in native code, the program will be faster but the VB runtime dll's will be always loaded to ensure the VB error handling.

  9. #9
    Gbin@ryR
    Guest
    Sorry andreanobile, but i've heard that P-code means Pseydo-code.

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides