 |
How other people should write their software
Author |
Message |
DancemasterGlenn
Veteran
Joined: Sat Apr 21, 2007 8:05 pm Posts: 637
|
_________________ I bring the trouble.
|
Mon Jul 28, 2008 6:21 am |
|
 |
I.S.T.
Zealot
Joined: Tue Nov 27, 2007 7:03 am Posts: 1325
|
VBA, or VBA-M? Two different emulators. VBA can have odd random slowdowns...
|
Mon Jul 28, 2008 6:21 am |
|
 |
leilei
Rookie
Joined: Fri Feb 22, 2008 8:46 pm Posts: 37
|
both
Then where's the problem?
p.s. also try bochs
_________________ o^_^o
|
Mon Jul 28, 2008 6:23 am |
|
 |
I.S.T.
Zealot
Joined: Tue Nov 27, 2007 7:03 am Posts: 1325
|
Both? Then some weird shit is going on. I don't have any weird slowdowns in VBA-M, only slowdowns that actually happen in the game.
BTW, leilei, you officially FAIL at reading what mudlord said.
*States bias*
I am a mod at VBA-M's forums, and my personal opinion on this topic is both mudlord and byuu are a little right and a little wrong.
|
Mon Jul 28, 2008 6:25 am |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
You failed to read, yet again, or you are a troll. Or both.
The problem is: code optimization WITHOUT hacks should matter. Byuu, on the other hand, thinks code clarity comes first before optimization. As such, we both have major unreconcilable differences due to the two different approaches, EVEN though they have nothing to do with accuracy.
And the whole point of this thread was a fight between us two over exactly that.
|
Mon Jul 28, 2008 6:26 am |
|
 |
adventure_of_link
Locksmith of Hyrule
Joined: Sun Aug 08, 2004 7:49 am Posts: 3634 Location: 255.255.255.255
|
so what
if I made a bug report for <insert software here> I'm violating people's rights because I'm telling them what to do with their unpaid time? also it should go ignored because that's how they choose to develop?
_________________
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
|
Mon Jul 28, 2008 8:20 am |
|
 |
byuu
|
Wrote up another one of my ten page rants on this subject here:
http://byuu.cinnamonpirate.com/articles/optimization
Mostly so that I don't have to keep discussing it with people in the future ;)
I really have no idea how you went from what I said to talking about reporting bugs and violating rights ...
I don't even know how to respond to your question.
|
Mon Jul 28, 2008 8:36 am |
|
 |
I.S.T.
Zealot
Joined: Tue Nov 27, 2007 7:03 am Posts: 1325
|
FWIW, I think it also depends on the type of program it is. I imagine there's zero reason to optimize the living shit out of a simple calculator, but one that can go well beyond what simple calculator can provide. At the same time, if it can deal with too many different variables and whatnot, then you'd want to focus on making the code readable.
That was probably a piss poor example, but I hope I got what I meant across.
|
Mon Jul 28, 2008 9:01 am |
|
 |
Nach
ZSNES Developer
Joined: Tue Jul 27, 2004 10:54 pm Posts: 3902 Location: Solar powered park bench
|
Non essential stuff doesn't have to make stuff more confusing, or even get in the way at all. They are not necessarily mutually exclusive.
bsnes:
ZSNES: bsnes:  |  |  |  | Code: case 0x4806: { r4806 = data;
unsigned table = (r4801 + (r4802 << 8) + (r4803 << 16)); unsigned index = (r4804 << 2); unsigned length = (r4809 + (r480a << 8)); unsigned addr = datarom_addr(table + index); unsigned mode = (memory::cartrom.read(addr + 0)); unsigned offset = (memory::cartrom.read(addr + 1) << 16) + (memory::cartrom.read(addr + 2) << 8) + (memory::cartrom.read(addr + 3) << 0);
//this can technically be 65536, but it has never been observed higher than 32768 ... //really need a way to determine both compressed and decompressed lengths, though. static const unsigned max_length = 32768;
offset = datarom_addr(offset); for(unsigned i = 0; i < max_length; i++) codec.buffer[i] = memory::cartrom.read(offset + i);
#if 0 printf("decompression: 4805=$%0.2x,4806=$%0.2x,4807=$%0.2x,4808=$%0.2x,480b=$%0.2x\n", r4805, r4806, r4807, r4808, r480b); printf("table=$%0.6x,index=%3d,length=%5d,mode=%d,offset=$%0.6x\n", table, r4804, length, mode, offset); #endif
switch(mode) { case 0: codec.decomp_mode0(max_length); break; case 1: codec.decomp_mode1(max_length); break; case 2: codec.decomp_mode2(max_length); break; }
decomp_offset = (r4805 + (r4806 << 8)) << mode; r480c = 0x80; } break;
|  |  |  |  |
ZSNES:
ZSNES does have an extra if in each case to ensure no invalid memory accesses in case no buffer has been allocated. Other than that, I think my code is easier to see what the essentials are. I certainly didn't convolute my handling of those registers with any cache logic. bsnes on the other hand has code like "codec.output[(decomp_offset++)", which is cache logic dirtying up the register's documentation. Functions for clarity people, functions! How come no one in emulation seems to have read Code Complete?
_________________ May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it. _____________ Insane Coding
Last edited by Nach on Mon Jul 28, 2008 11:28 am, edited 2 times in total.
|
Mon Jul 28, 2008 11:07 am |
|
 |
Nach
ZSNES Developer
Joined: Tue Jul 27, 2004 10:54 pm Posts: 3902 Location: Solar powered park bench
|
I'm about half done with it. I just got side tracked optimizing the SPC7110 code, and will finish it when I'm done with SPC7110. I just take priority with ZSNES over VBA-M, sorry.
_________________ May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it. _____________ Insane Coding
|
Mon Jul 28, 2008 11:19 am |
|
 |
adventure_of_link
Locksmith of Hyrule
Joined: Sun Aug 08, 2004 7:49 am Posts: 3634 Location: 255.255.255.255
|
Eh, don't worry about it. Last night I was on edge and I was feeling sleep deprived, and I was being a smartass. I apologize.
still, isn't a proper bug report telling the devs to fix the bug(s) in the software? 
_________________
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
|
Tue Jul 29, 2008 1:16 am |
|
 |
DancemasterGlenn
Veteran
Joined: Sat Apr 21, 2007 8:05 pm Posts: 637
|
I think we need to think about the difference between "program bugs" and "coding techniques".
_________________ I bring the trouble.
|
Tue Jul 29, 2008 5:03 am |
|
 |
AamirM
Regen Developer
Joined: Sun Feb 17, 2008 8:01 am Posts: 533
|
Hi,
Once again a nice article. Always good to read your stuff. But I think there are a few a subtle and important points which you didn't explain very clearly.
1) While independent model works best for SNES (because thats how it really works), there are machines where enslavement model is the way to go simply because thats how they work (the master has knowledge of a slave) and you gain many of the benefits which you mentioned for the independent model in your article.
2) Although not strictly code clarity vs. optimization thing, but you must very clearly state that bsnes isn't meant to play games (at least not right now, maybe few years later). Face the truth, about 99% of the people who try your emulator try it to play a game and when they can't (due to speed reasons) they come and blame you here. If you do a simple google search, you'll find that nearly on every forum there will be someone who will sugggest bsnes to play games.
Again, these are just my own opinions. For those who want both speed and accuracy they'll have to wait for ASNES  .
stay safe,
AamirM
|
Tue Jul 29, 2008 9:32 am |
|
 |
henke37
Lurker
Joined: Tue Apr 10, 2007 4:30 pm Posts: 152 Location: Sweden
|
Speed reasons? That's what we have frameskip for. I personally believe that it's the games that doesn't work at all that's the bigger turn off.
|
Tue Jul 29, 2008 11:55 am |
|
 |
tetsuo55
Regular
Joined: Sat Mar 04, 2006 3:17 pm Posts: 307
|
Guess ill add my view too, but before i do:
i am a terrible programmer, at this very moment i am probably unable to write hello world in basic BUT i can often understand what byuu's code its trying to do.
This proves that byuu's approach does work for the readability part.
i also have a friend who uses his "functions" to create readability, his code is also completely understandable just by reading the functions names.
Now here is my idea on the whole thing, all 3 points are equally as important:
1: Code should be readable for other parties, however it doesnt matter if this is done like byuu or with functions or with comments.
2: Code should be written for the future and not the today (current target should be x64, SSSE3E, unlimited cores), while coding keep backwards compatibility in mind(x86,mmx(multithreading is only slightly slower on a single core, so no special care need be taken))
3: the code should be as optimised as possible, although its written with fast computers in mind, it should work on the slowest handheld device.
Now accuracy of emulation has nothing to do with the above 3 priorities, thats a completely different thing altogether, the above 3 priorities are overal for any code from OS to Drivers to Calculators.
that being said, i have only ever met/heard about 1 person who does all 3
|
Tue Jul 29, 2008 12:21 pm |
|
 |
byuu
|
Unfortunately I don't know enough about other systems to really comment on that, so I'll take your word for it. But FWIW, the SMP really was the ideal processor for enslavement. I can't imagine a setup better designed for that.
I wasn't aware that only 1% of the population had processors less than three years old. Now, I would buy 80-90% of people find it to be too slow, sure. But even that is probably an exaggeration, unless you're talking about the just-added SPC7110 support.
|
Tue Jul 29, 2008 5:25 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
....So, in my involuntary absence (for mental health reasons, go ahead and laugh), I return to a already fucked up life (and now worse), AND yet I see a rant, debating the merits of code clarity over raw optimization for speed on less than brand new processors? Enough of that. I might as well post on my blog why I care about optimization, even on top end PCs and my personal beliefs on the matter as such. Anywayz, nice rant. Makes sense  . And I'm glad you get my view, in that when I talk about "optimization" I am not talking about accuracy hindering hacks (which to me, definately seem wrong). So, least we both believe game affecting hacks = bad.  EDIT:
No problems  . I tend to juggle time with VBA-M. Depends on my mood, really (sometimes I don't do any work on it at all. I mainly code when I feel like).
|
Thu Jul 31, 2008 1:51 am |
|
 |
byuu
|
Be nice already, you're making Mr. Whiskers sad =(
:P
|
Thu Jul 31, 2008 2:43 am |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Awww, isn't that the pot calling the kettle black?
Oh well, I still intend on writing a rebuttal on why I think the way I do. I had enough of this bickering, its best to "argue" intelligently. 
|
Thu Jul 31, 2008 3:26 am |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Can't wait to see what you do.
Though, I like BSNES too. 
|
Thu Jul 31, 2008 5:24 am |
|
 |
Rashidi
Trooper
Joined: Fri Aug 18, 2006 2:45 pm Posts: 515
|
ASNES? is that Assembly (& hand-optimized) version of BSNES?
i'll definetly wait for something like that 
|
Thu Jul 31, 2008 6:44 am |
|
 |
byuu
|
|
Thu Jul 31, 2008 7:32 am |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Okay, I'll be nice. For Mr Kitty's sake as well. 
|
Thu Jul 31, 2008 8:08 am |
|
 |
AamirM
Regen Developer
Joined: Sun Feb 17, 2008 8:01 am Posts: 533
|
Hi,
Hah, I doubt I'll do any better. I am sure ZSNES will fill up the space for a fast and accurate emu soon. I like bsnes too but I've never been able to run it full speed on my PC  .
stay safe,
AamirM
|
Thu Jul 31, 2008 7:30 pm |
|
 |
grinvader
ZSNES Shake Shake Prinny
Joined: Wed Jul 28, 2004 4:15 pm Posts: 5616 Location: PAL50, dood !
|
_________________ 皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
|
Thu Jul 31, 2008 7:58 pm |
|
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
|
 |
|