[Z88dk-users] Compile Times

Bridge to the z88dk-users mailing list
Post Reply
bill2009
Member
Posts: 28
Joined: Wed Jan 06, 2016 2:16 pm

[Z88dk-users] Compile Times

Post by bill2009 »

I am compiling a program that's 700-1000 lines of C including my includes but excluding stdlib etc. I'm using z88dk/sdcc on an older i5 processor with 8G of memory. The compile is taking approximately 110 seconds which seems very long. Is this expected or could i be doing something wrong?

The bulk of the code is pasted here https://wordpress.com/post/olduino.wordpress.com/79861

UPDATE: max-allocs-per-node5000 got it down to a much more tolerable 20 seconds



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/ ... 1&iu=/4140
Last edited by bill2009 on Tue Feb 16, 2016 9:53 pm, edited 1 time in total.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

I am compiling a program that's 700-1000 lines of C including my includes but excluding stdlib etc. I'm using z88dk/sdcc on an older i5 processor with 8G of memory. The compile is taking approximately 110 seconds which seems very long. Is this expected or could i be doing something wrong?

The bulk of the code is pasted here https://wordpress.com/post/olduino.wordpress.com/79861

UPDATE: max-allocs-per-node5000 got it down to a much more tolerable 20 seconds
Yes long compile times are normal with sdcc when optimization is turned up. As you noted, you can lower optimization level to speed up compiles at the expense of code quality which is ok if you want to speed up development time. The default optimization level set by sdcc itself is 3000.

I have programs that take 15 mins to compile.



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/ ... 1&iu=/4140
bill2009
Member
Posts: 28
Joined: Wed Jan 06, 2016 2:16 pm

Post by bill2009 »

I am compiling a program that's 700-1000 lines of C including my includes but excluding stdlib etc. I'm using z88dk/sdcc on an older i5 processor with 8G of memory. The compile is taking approximately 110 seconds which seems very long. Is this expected or could i be doing something wrong?

The bulk of the code is pasted here https://wordpress.com/post/olduino.wordpress.com/79861

UPDATE: max-allocs-per-node5000 got it down to a much more tolerable 20 seconds
Yes long compile times are normal with sdcc when optimization is turned up. As you noted, you can lower optimization level to speed up compiles at the expense of code quality which is ok if you want to speed up development time. The default optimization level set by sdcc itself is 3000.

I have programs that take 15 mins to compile.



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/ ... 1&iu=/4140
Ahh, Ok, thanks - I'm going to look at code size but i'll go with the default - i had pushed up my default to 20000 and forgotten about it.



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/ ... 1&iu=/4140
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Ahh, Ok, thanks - I'm going to look at code size but i'll go with the default - i had pushed up my default to 20000 and forgotten about it.
3000 is the default, we usually run at 200000 when coming up with peephole rules and I believe Philip (the z80 sdcc port implementer) likes to run at 1000000 when comparing size and speed with other compilers.

If you translate to assembler using "-a":

zcc +cpm -vn -a -SO3 -clib=sdcc_iy --max-allocs-per-node200000 test.c --fverbose-asm

An additional flag "--fverbose-asm" will add some comments into the output source underneath each function header indicating whether max-allocs was high enough for optimal register assignment. If it's not, then a higher max-allocs might produce better code.

sdcc also has options "--opt-code-size" and "--opt-code-speed", neither of which currently impact on code generation, except "--opt-code-size" will cause the compiler to use a subroutine call rather than inlined code at the beginning of each function to create the stack frame. This will save a few bytes so if code size is a concern, you should turn that on.

The kind of code that requires high max-allocs typically has a lot of local variables (relatively speaking).



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/ ... 1&iu=/4140
Post Reply