View unanswered posts | View active topics It is currently Sat Dec 14, 2019 4:11 am



This topic is locked, you cannot edit posts or make further replies.  [ 83 posts ]  Go to page Previous  1, 2, 3, 4  Next
How other people should write their software 
Author Message
Veteran
User avatar

Joined: Sat Apr 21, 2007 8:05 pm
Posts: 637
Post 
Quote:
OMG NOT OPTIMIZED FOR YOUR CRAP COMPUTER


Shut up leilei.

_________________
I bring the trouble.


Mon Jul 28, 2008 6:21 am
Profile
Zealot

Joined: Tue Nov 27, 2007 7:03 am
Posts: 1325
Post 
VBA, or VBA-M? Two different emulators. VBA can have odd random slowdowns...


Mon Jul 28, 2008 6:21 am
Profile
Rookie
User avatar

Joined: Fri Feb 22, 2008 8:46 pm
Posts: 37
Post 
I.S.T. wrote:
VBA, or VBA-M? Two different emulators. VBA can have odd random slowdowns...

both

mudlord wrote:
It aint slow at BSNES.

Then where's the problem?

p.s. also try bochs

_________________
o^_^o


Mon Jul 28, 2008 6:23 am
Profile
Zealot

Joined: Tue Nov 27, 2007 7:03 am
Posts: 1325
Post 
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
Profile
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
Then where's the problem?


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
Profile
Locksmith of Hyrule
User avatar

Joined: Sun Aug 08, 2004 7:49 am
Posts: 3634
Location: 255.255.255.255
Post 
byuu wrote:
everyone should be free to develop however they want, and nobody has the right to tell others what they should be doing with their unpaid time. This goes for past poorly-made comments I've made, as well.


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?

_________________
Image
<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
Profile YIM WWW
Post 
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 ;)

Quote:
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?


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
Zealot

Joined: Tue Nov 27, 2007 7:03 am
Posts: 1325
Post 
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
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3902
Location: Solar powered park bench
Post 
byuu wrote:
The SPC7110 code I have may not be lightning fast like in ZSNES, but it serves an important purpose: unlike with the register text document, it's possible to understand what each register fully does. And there's no non-essential stuff getting in the way of the raw implementation.


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:
Code:
    case 0x4800: {
      uint16 counter = (r4809 + (r480a << 8));
      counter--;
      r4809 = counter;
      r480a = counter >> 8;
      return codec.output[(decomp_offset++) & 0xffff];
    }


ZSNES:
Code:
void SPC7110_4800()
{
  WRITE_WORD16_LE(SPCCompressionRegs+9, READ_WORD16_LE(SPCCompressionRegs+9)-1);
  if (decompression_state.table_current)
  {
    SPCCompressionRegs[0] = read_decompress();
  }
}


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:
Code:
void SPC7110_4806w()
{
  if (decompression_state.graphics_buffer)
  {
    init_decompression(READ_WORD24_LE(SPCCompressionRegs+1), SPCCompressionRegs[4], READ_WORD16_LE(SPCCompressionRegs+5));
  }

  SPCCompressionRegs[0xC] = 0x80;
}


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
Profile WWW
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3902
Location: Solar powered park bench
Post 
mudlord wrote:
You could persuade Nach to get UPS support in. All my reminders to him have fallen on death ears, since he seemed very interested to implement it. :(

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
Profile WWW
Locksmith of Hyrule
User avatar

Joined: Sun Aug 08, 2004 7:49 am
Posts: 3634
Location: 255.255.255.255
Post 
byuu wrote:
Quote:
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?


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.

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? :P

_________________
Image
<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
Profile YIM WWW
Veteran
User avatar

Joined: Sat Apr 21, 2007 8:05 pm
Posts: 637
Post 
adventure_of_link wrote:
still, isn't a proper bug report telling the devs to fix the bug(s) in the software? :P

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
Profile
Regen Developer
Regen Developer
User avatar

Joined: Sun Feb 17, 2008 8:01 am
Posts: 533
Post 
Hi,

byuu wrote:
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 ;)


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 :twisted: .

stay safe,

AamirM


Tue Jul 29, 2008 9:32 am
Profile WWW
Lurker

Joined: Tue Apr 10, 2007 4:30 pm
Posts: 152
Location: Sweden
Post 
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
Profile WWW
Regular

Joined: Sat Mar 04, 2006 3:17 pm
Posts: 307
Post 
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
Profile
Post 
Quote:
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


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.

Quote:
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.


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
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
Mostly so that I don't have to keep discussing it with people in the future ;)



....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 8) . 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. :P

EDIT:

Quote:
I just take priority with ZSNES over VBA-M, sorry.


No problems 8) . 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
Profile
Post 
Quote:
I see a rant, debating the merits of code clarity over raw optimization for speed on less than brand new processors?

Enough of that.


Be nice already, you're making Mr. Whiskers sad =(

Image

:P


Thu Jul 31, 2008 2:43 am
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
Be nice already, you're making Mr. Whiskers sad =(


Awww, isn't that the pot calling the kettle black? :P

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. 8)


Thu Jul 31, 2008 3:26 am
Profile
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
For those who want both speed and accuracy they'll have to wait for ASNES


Can't wait to see what you do. :D
Though, I like BSNES too. :P


Thu Jul 31, 2008 5:24 am
Profile
Trooper
User avatar

Joined: Fri Aug 18, 2006 2:45 pm
Posts: 515
Post 
mudlord wrote:
Quote:
For those who want both speed and accuracy they'll have to wait for ASNES
Can't wait to see what you do. :D
Though, I like BSNES too. :P
ASNES? is that Assembly (& hand-optimized) version of BSNES?
i'll definetly wait for something like that :D


Thu Jul 31, 2008 6:44 am
Profile
Post 
Quote:
Awww, isn't that the pot calling the kettle black? :P


Image


Thu Jul 31, 2008 7:32 am
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Okay, I'll be nice. For Mr Kitty's sake as well. 8)


Thu Jul 31, 2008 8:08 am
Profile
Regen Developer
Regen Developer
User avatar

Joined: Sun Feb 17, 2008 8:01 am
Posts: 533
Post 
mudlord wrote:
Quote:
For those who want both speed and accuracy they'll have to wait for ASNES


Can't wait to see what you do. :D
Though, I like BSNES too. :P


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 :cry: .

stay safe,

AamirM


Thu Jul 31, 2008 7:30 pm
Profile WWW
ZSNES Shake Shake Prinny

Joined: Wed Jul 28, 2004 4:15 pm
Posts: 5616
Location: PAL50, dood !
Post 
AamirM wrote:
I am sure ZSNES will fill up the space for a fast and accurate emu soon.

I wonder...

_________________
皆黙って俺について来い!!
Code:
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54


Thu Jul 31, 2008 7:58 pm
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 83 posts ]  Go to page Previous  1, 2, 3, 4  Next

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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.