2004-02-16-2259Z


Working on some proof of concept code for the new version of postforth, I noticed that the forth code only used about .1% of the CPU while the corresponding C routine used 100%. WTF? It had to be CPU bound, there was no I/O of any kind being done. But then I saw that while only .1% was shown for the process, the CPU was pegged (using top). So I realized that the CPU being used was allocated to the kernel not the user process. I guess because it's mostly stack manipulations? Weird. In any case, the forths, both subroutine-threaded and direct-threaded, are only twice as slow as the corresponding C program. That disadvantage in speed may disappear in a complex application, and hopefully when done postforth will make for much more easily maintainable code.

Back to blog or home page

last updated 2013-01-10 20:14:28. served from tektonic.jcomeau.com