Link to home
Start Free TrialLog in
Avatar of chee68
chee68

asked on

P-code and Native Code

Hi,

What is the significant diference between P-code and Native code.  Which one is better in terms of performance?  Why?  Which code is recommanded?

Thanks

chee
ASKER CERTIFIED SOLUTION
Avatar of Marine
Marine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of halapaya
halapaya

native code is better.

P-code, or pseudo code, is an intermediate step between the high-level instructions in your Basic program and the low-level native code your computer's processor executes.

so.. if u choose p-code; ut again converts each line of ur code to native code , before executing.

but native code... this intermediate converting of line by line is not happening.. thus good performance. cause at compile time it directly compile to native code.

Compiling a project with the Native Code option will fully compile ur proggy to the native instructions of the processor chip, instead of being compiled to p-code. This will greatly speed up loops and mathematical calculations, and may somewhat speed up calls to the services provided by MSVBVM60 virtual machine.

so recomended is p-code.

native code is better.

P-code, or pseudo code, is an intermediate step between the high-level instructions in your Basic program and the low-level native code your computer's processor executes.

so.. if u choose p-code; ut again converts each line of ur code to native code , before executing.

but native code... this intermediate converting of line by line is not happening.. thus good performance. cause at compile time it directly compile to native code.

Compiling a project with the Native Code option will fully compile ur proggy to the native instructions of the processor chip, instead of being compiled to p-code. This will greatly speed up loops and mathematical calculations, and may somewhat speed up calls to the services provided by MSVBVM60 virtual machine.

so recomended is p-code.

i guess you made a type Native Code is better better optimization.
opppsssssssss :o)
RECOMENDED IS NATIVE CODE... NOT PCODE..
darn.. these guys will kill me for that :o) SORRRYYYY :o)
MicroSoft must have had a reason to include p-code, what are the advantages of it ?? is it more portable ? i.e. will it run on Alpha as opposed to x86 or on a ZX81 ???

Smeggy Smeggster.
p-code is indeed more portable than native code, which is one advantage (It should even run on a Z-80 processor provided you can find a VB p-code interpreter for that ;-).
Another one is that the executable size is a lot smaller.
Yet another is that your compile time is a lot shorter.
Actually p-code CAN be faster than native code, but in most cases the native code is faster. I read somewhere that if you do a lot of  databases access can get better performance using p-code. Don't know why but this was the case.

Don't forget the "advanced settings" when you compile, they can really give you some great performance boosts. ;)