* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Jumpman Resurrected  (Read 4305 times)

0 Members and 1 Guest are viewing this topic.

Offline Lionel Debroux

  • Full User
  • Join Date: Jan 2015
  • Location:
  • Posts: 230
  • Post Rating Ratio: +11/-0
    • debrouxl
    • 58/5891
Re: Jumpman Resurrected
« Reply #45 on: October 31, 2017, 07:36:27 pm »
I'm now looking at the project, and I have several optimization suggestions :)
* first and foremost: unless you experience issues with optimized compilation, which is very infrequent, you should compile with optimization (-Os compiler flag), which, besides speeding up the program, also saves a fantastic amount of space ;)
* on top of that, the -fomit-frame-pointer -mregparm=5 compiler flags save some more space;
* you really should dynamically allocate 5 huge variables: external_level_buffer (jm_levels.c) and the four LCD_SIZE'd variables from jm_graphics.c. You can allocate a single block and play with pointer arithmetic a bit. Currently, they get stored in BSS, but BSS suck for both size and speed efficiency - both directly, because of inefficient instructions + relocation information, and indirectly, because they can prevent from making other optimizations. Getting rid of BSS for most programs I worked on, not just TICT programs, was a major win.
* for now, using compressed relocations and compressed references for BSS saves some more space. When the above variables are dynamically allocated, the BSS becomes small enough to merge with the main executable, and compressed BSS references are moot.
* you used the old, large version of IsVTI(); the newest version can be found inline in e.g. https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/archive/gray.s or in https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/archive/hw_version.s ;
* in GraySetScreenColor_R(): 1) move.l #0xffffffff,%d0 / %d5 would be much better as moveq #-1,%d0 / % d5, 2) the andi.l instructions would be smaller and faster as moveq to an additional register followed by and.l, 3) the cmpi.b instructions might be redundant because the andi.l (with a single-bit mask) already sets the CCR flags, 4) you should use explicit short branches;
* in GraySingleSprite8_COLOR_R(): 1) cmpi.w #0,%d4 is better written as tst.w %d4 (and you could even avoid the tst.w %d4 if you load d6 before loading d4), 2a) given that you're not using the upper part of d5, you should use moveq # instead of move #, 2b) in fact you could replace everything between __GraySingleSprite8_R__Test_WHITE and __GraySingleSprite8_R__Test_Finish by a single lsr.w #3,%d4 instruction (and thereby avoid using d5 at all), 3) you should use an explicit .l on the adda, 4) you should use explicit short branches.

This computer doesn't have GCC4TI binaries, I'll have to build them... or use the other computer's binaries.

On my side, the current build stats for jumpman are:
Code: [Select]
  Program Variable Size:                    45249 Bytes
  BSS Size:                                 47878 Bytes
  Absolute Relocs:                          712
  Natively Emitted Relocs:                  2
  Relocs Removed by Branch Optimization:    299
  Relocs Removed by Move Optimization:      211
  Relocs Removed by Test Optimization:      5
  Space Saved by Range-Cutting:             1110 Bytes
« Last Edit: November 01, 2017, 07:46:47 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games