Page 1 of 1

compiled size

Posted: 07 January 2006, 7:21 AM
by DH*
I have a >2550 line BX-24 project which compiled to ~26K with BasicX.

It compiles to 16K with ZBasic.

Is this for real?

Posted: 07 January 2006, 8:54 AM
by mikep
Yes this is for real. ZBasic produces much more compact code than BasicX. The reason is that many functions in BasicX are expanded out to inline code. BasicX has 122 system library functions, 48 of which are implemented as extra code.

ZBasic has a much larger flash memory so these functions and more are all implemented in the runtime - hence the compiled code is much smaller.

I have examined the details of the BasicX internals and explain more about this in part 3 and part 4 of my series of articles http://home.austin.rr.com/perks/micros/Articles/.

Posted: 07 January 2006, 9:05 AM
by dkinzer
The size difference that you observed is atypical. It is more common to see a reduction in the 10% to 25% range but in some cases I have seen a very large difference and in some, virtually no difference.

Posted: 07 January 2006, 13:23 PM
by DH*
I'm impressed. I use the free EEPROM for data and was hoping to gain 1-2K but this will let me add some desired features as well.

Posted: 13 January 2006, 12:00 PM
by DH*
Now I'm confused.

With BasicX the reported compile size and .bxb file size were the same. With ZBasic the IDE reports 16K but the .zxb file is 47K.

Posted: 13 January 2006, 12:25 PM
by dkinzer
With BasicX the reported compile size and .bxb file size were the same. With ZBasic the IDE reports 16K but the .zxb file is 47K.
That's because with BasicX the .bxb file is a memory image whereas with ZBasic the .zxb is an Intel Hex format file. This standard format (with some extensions) was chosen because it is checksummed. The disadvantage is that downloading takes longer.

Each record holds a maximum of 16 data bytes and there are 13 bytes of overhead for each record. Consequently, the size of a .zxb file will be approximately (size * 2) + INT((size +15) / 16) * 13.