Machine Code
\The Sandbox \PB Help \Troubleshoot \Machine Code
Machine Code
Anyone Else
See It?

To a typical developer using traditional logic, there is an obvious benefit to using machine code over an interpreted PCode. However, this benefit is often overstated and comes at a cost.

Runtime Performance Benefits

Using traditional wisdom, machine code should produce better runtime performance. However, even Sybase qualifies the conditions under which machine code will produce a performance benefit. According to Sybase manuals, applications that will benefit from machine code are applications that make heavy use of:

  • looping constructs
  • floating point or integer arithmetic
  • function calls

What this will exclude is many of the points in an application that cause “most” bottlenecks in “most typical client/server applications”: (according to Sybase staff at education session like TechWave)

  • network/database access
  • disk access
  • screen painting
  • object instantiation
  • memory allocation

Keep in mind that with a PCode executable, most of what you run is already compiled with machine code in the form of the PowerBuilder virtual machine and other PowerBuilder DLLs.

Development Costs

The cost of building to machine code has two primary costs in the development stage:

  • vastly increased compile times
  • inability to use exception handling, which isn’t supported in machine code

There is also a deployment cost in the form of larger executables. This may be more or less significant depending on your deployment methods.

Reliability Issues

In an ideal situation, the PowerBuilder bug list would be identical between PCode and machine code environments. However, this is not true for a couple of reasons. PCode is much more heavily used (anyone who runs out of the IDE exercises the PCode execution), so it is much more heavily tested and in much more demand to be reliable. The other issue that would introduce bugs is the fact that PowerScript/PCode has to go through a process of conversion to C/C++ before compiling, a process which could contain bugs itself. So, you should anticipate the possibility of new bugs cropping up in your machine code executables that you didn’t find in your testing through the IDE.

In addition, the compiling process itself is prone to trouble. Simple issues such as the compiler can’t handle temp directories with spaces in the names (pretty standard under later OSes) plague compilation. If you’re running into problems, make sure you search Sybase’s Technical documents library, especially the one focussing on machine code issues.

Bottom Line

  • If your problem is occurring at run time under a machine code build, make sure you test with a PCode build. It may be your quickest way out if the problem is a machine code run time problem.
  • Seriously consider whether or not you need to use machine code. Include benchmarks of your application in your consideration. There are places to use machine code, but it should not just be a default choice.
PBL Peeper PB Help PB History
& Future About Us Feedback Site Map