03 March 2020, 21:06 | #181 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Does optimisation reduce readability ?
Not always, but sometimes yes. However you should notice that at the time of doing it. And then it might be a good idea to add some comment explaining what you've done, so it doesn't get abused later. |
03 March 2020, 23:27 | #182 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
It's probably just my patience (or lack thereof), but to me, unmaintainable means that I have to spend more than 30 seconds figuring out what I did there. It's perhaps just side effect of getting older
|
03 March 2020, 23:34 | #183 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
But, on 1.79 MHz 6502, the approach I found works best is wrapping each version in a separate compile-time block with two lines of description of the changes to the previous one. One such texturing method received about dozen versions and it never takes more than 15 minutes to understand them. But if I had just the last one, it would be merely WTF moment I'm all ears how you guys handle this. |
|
04 March 2020, 00:49 | #184 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,017
|
Quote:
|
|
04 March 2020, 08:43 | #185 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
That can be avoided by properly commenting the code. I guess each of us has a different definition what unmaintainable means, in the end it is important that, no matter how much you optimise code, you should still be able to understand why/how something has been done. |
|
04 March 2020, 11:19 | #186 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,642
|
Interesting and relevant, but I think we're getting off topic here
|
12 December 2020, 00:10 | #187 | |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,370
|
anyone took a look at this old page?
https://web.archive.org/web/20040905...ldin/main.html algorithm Code:
signum(x) if x > 0 then return 1 else if x < 0 then return -1 else return 0 (x in D0) Code:
ADD.L D0,D0 (Add D0 to itself) SUBX.L D1,D1 (Subtract (D1 + Carry) from D1) NEGX.L D0 (Put (0 – D0 – Carry) into D0) ADDX.L D1,D1 (Add (D1 + Carry) to D1 Quote:
|
|
12 December 2020, 09:51 | #188 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
|
12 December 2020, 13:08 | #189 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,370
|
yeah it's exactly the same code. But it just illustrated the result of a machine optimizing asm. I fail to see how it works exactly but I'd like to see that in action.
Let's imagine some 3D games or otherwise slow games benefitting from this... (if it's not a blitter limitation) |
12 December 2020, 14:40 | #190 | |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
Quote:
Don't think it will magically speed up many games to be honest. |
|
12 December 2020, 15:12 | #191 | |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
Quote:
I've never used negx. Trying to think of a useful scenario for it. I guess you could save a couple of cycles if you were counting the number of zeros in a steam or something: Code:
moveq #0,d2 ;number of non zeros moveq #0,d1 ;leave 0 ... moveq #0,d0 ;get number to test negx.w d0 ;carry set unless 0 addx.w d1,d2 ;Increase count by 1 if non zero .notzero: Code:
moveq #0,d2 ;number of non zeros ... moveq #0,d0 ;get number to test beq.s .zero addq.w #1,d2 .zero: Any other creative uses? Last edited by Antiriad_UK; 12 December 2020 at 17:03. |
|
12 December 2020, 16:03 | #192 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
The article isn't about signum though (that's just the example they picked to showcase what it's about). It's about a rather extreme way to optimise code where the optimizer doesn't use pre-designed optimisations but instead tries out every single combination of instructions that exists for that particular problem and leads to a valid result. Then the optimizer picks the smallest/fastest result out of the valid solutions it generated.
They point out it's only viable for very small algorithms as the required computing & storage power quickly spirals out of control. Still, an interesting approach. Last edited by roondar; 12 December 2020 at 16:12. |
12 December 2020, 16:11 | #193 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
i'm not sure negx.w does exactly what you want there
|
12 December 2020, 17:02 | #194 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
|
12 December 2020, 17:21 | #195 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
|
12 December 2020, 17:23 | #196 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,313
|
|
12 December 2020, 17:24 | #197 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,370
|
you're getting me wrong
I mean: if there's a tool that can super-optimize people code automatically, then using it on some existing code (3D for instance) could speed it up. For instance 3D games, or games requiring a lot of CPU. Signum was just an example. |
12 December 2020, 17:48 | #198 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
This kind of optimizer dies as soon as the code is more than just a few lines. For this reason i doubt it's of any use for 3d (or any game at all).
|
12 December 2020, 18:03 | #199 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,370
|
that was just too good to be true
seemed to rely on bruteforce check of all combinations... but maybe this kind of optimizer is able to work by blocks to reduce combinatorics. Combining that and winuae hotspots to know where the code spends the most of the time... |
05 June 2021, 18:33 | #200 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,370
|
I saw that in Supercars 2
Code:
move.l a0,(a4)+ ;mask move.l a1,(a4)+ ;data0 move.l a2,(a4)+ ;scn0 Code:
movem.l a0-a2,(a4)+ |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
68000 boot code | billt | Coders. General | 15 | 05 May 2012 20:13 |
Wasted Dreams on 68000 | sanjyuubi | support.Games | 5 | 27 May 2011 17:11 |
680x0 to 68000 | Counia | Hardware mods | 1 | 01 March 2011 10:18 |
quitting on 68000? | Hungry Horace | project.WHDLoad | 60 | 19 December 2006 20:17 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|