Showing posts from February, 2010

Pascal features you can fall in love with

I am a bit sentimental I admit it. For years and years and years I've been writing and teaching Pascal, Pascal OOP and Delphi (not since 1999 though). Ever since the early days I had a certain fondness ofn the Pascal enumerated types and the Ord() function.

The Ord function returns a cardinal number (integer) for any given ordinal type. Ordinal Types are cardinal numbers like byte, integer, shortint etc., chars (!) and enumerated types. So Ord(0) = 0, and Ord('@') = 64 as 64 is the ASCII code of the '@' char in the order of the ASCII characters. Nice.
In the same category as Ord(), are the functions Pred(), Succ() and procedures Inc() and Dec(), which increase and decrease ordinal numbers. Things like Inc ('A', 32) is a valid thing in Pascal, and increases the ordinal value of 'A' by 32, making it an 'a'. Thus making the nicest of capitalisation routines that you can find in any computer language: if (c in ['A'..'Z']) then // co…

GetDIBits vs. Scanline vs. Pixels[] in Delphi Bitmaps

I've been always wanting to sit down one day and solve this problem; test the speed of manipulating pixels on a Bitmap using the three options:

- the convenient but understandably slow Pixels[],
- the "interesting" Scanline property and
- the Windows API GetDIBits and SetDIBits.I have been traditionally using Pixels for quick work and the Get/SetDIBits for low-level pixel manipulation such as the filters used in ToolBox. Never really used the Scanline property in anger, I was always thinking, DIBits "had" to be quicker. Little I knew...I have been experimenting with two tools that I've written and never released to the public domain. The first is the BMPCreator which I wrote in order to create 256-level grayscale bitmaps, the other is the IconCreator which uses a grayscale bitmap and applies color maps to it, giving you the ability to create different colored versions of the same icon (like in my database visualization tool VirtualTreeNavigator).Yesterday I wr…

And you thought Chrome was the best...

Wowdi! Didn't expect that. "The Register" reported the news about Opera 10.5 beta and I immediatelly went to download the latest version. Using my own "benchtests", i.e. the little JS/HTML5Canvas expirements I wrote during the last few months (Mandelbrot and 3D Dissolve JS), I compiled the following list:

BrowserMandelbrot (ms) (*)Dissolve (fps) (**)Chrome 4.0124848.1Firefox 3.6127751.3Opera 10.5beta36972.3Safari 4.0255149.2
(*) Lower times (in milliseconds) are better
(**) Higher FPS rate is better

There you go then, Opera annihilates the competition with a beta! That will make some Google and FF engineers scratch their heads a little bit. Firefox 3.6 came with a lot of improvements closing the gap to Chrome. Opera now comes and from being the slowest browser in JS now becomes the fastest with a difference! More than 3x the speed of Chrome in Mandelbrot? That is absolutely amazing.

Very well done guys, you are obviously doing the right thing up there in the North.…