View unanswered posts | View active topics It is currently Wed Apr 24, 2019 8:01 pm



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

Joined: Sun Aug 08, 2004 7:49 am
Posts: 3634
Location: 255.255.255.255
Post 
mudlord wrote:
Okay, I'll be nice. For Mr Kitty's sake as well. 8)


how about this one:

Image

_________________
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.


Thu Jul 31, 2008 11:28 pm
Profile YIM WWW
Zealot

Joined: Tue Nov 27, 2007 7:03 am
Posts: 1325
Post 
byuu wrote:
Quote:
Awww, isn't that the pot calling the kettle black? :P


Image


OH MY GOD THAT'S SO CUTE I WANT ONE


Fri Aug 01, 2008 2:13 am
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Post 
Oooh! Breakfast! :twisted:

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Fri Aug 01, 2008 9:45 am
Profile WWW
Regular
User avatar

Joined: Thu Jun 30, 2005 1:54 pm
Posts: 327
Location: USA
Post 
Breakfast? That's unsustainable; try this instead: kitten huffing.


Fri Aug 01, 2008 11:20 am
Profile WWW
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
Oooh! Breakfast!


Doesn't grinvader eat kittens? :o


Fri Aug 01, 2008 11:35 am
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Post 
mudlord wrote:
Quote:
Oooh! Breakfast!


Doesn't grinvader eat kittens? :o

Yes. But someone had to preempt him for once.

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Fri Aug 01, 2008 11:59 am
Profile WWW
Trooper
User avatar

Joined: Mon Feb 20, 2006 3:11 am
Posts: 394
Location: Space
Post 
Nach wrote:
Oooh! Breakfast! :twisted:

Indeed...

Image

_________________
Kega Fusion Supporter | bsnes Supporter | Regen Supporter


Fri Aug 01, 2008 3:49 pm
Profile
ZSNES Shake Shake Prinny
User avatar

Joined: Wed Jul 28, 2004 4:15 pm
Posts: 5613
Location: PAL50, dood !
Post 
Nach wrote:
mudlord wrote:
Quote:
Oooh! Breakfast!


Doesn't grinvader eat kittens? :o

Yes. But someone had to preempt him for once.

Those ones looked diseased.

I don't fancy poisoned treats.

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

Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54


Fri Aug 01, 2008 8:15 pm
Profile
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
byuu,

http://mudlord.blogspot.com/2008/08/spe ... arity.html

There's my abbreviated response. I could have expanded a lot more, but I chose not to.

But basically, it shows the gist of what I think about optimization, and what I think of bloat & the relevance of optimization on ultra modern hardware.

Feel free to make a article as a rebuttal. I don't really mind. 8)

EDIT: Fixed spelling and stuffles in blog post.


Last edited by mudlord on Tue Aug 05, 2008 9:56 am, edited 2 times in total.



Tue Aug 05, 2008 8:08 am
Profile
ZSNES Developer
ZSNES Developer

Joined: Tue Dec 28, 2004 6:47 am
Posts: 6747
Post 
Nach and I had a small discussion regarding this.. it falls to a few things IMO.

When CS/programming is taught, the students are never taught to optimize. This is a huge failure since this problem becomes systemic and there are tons of programs produced that could be significantly faster than what was written for it. I could easily point to games being a culprit, but an even more pratical example is the freaking word processor. When you think about load times, you shouldn't be requires to beef up your computer massively just to get Word running better. It makes absolutely no sense to me. Something like Word should load up as fast as Notepad, but that simply is not the case. Maybe it seems that I'm asking for a lot, but considering that it shouldn't consume insane resources or insane CPU just to write up a document. Is that asking too much? I don't think so.

One other thing.. commenting code nowadays seems to be a lost art, since it's probably not used so people can be mystified at what to do before eventually overhauling the code again...

_________________
Continuing FF4 Research...


Tue Aug 05, 2008 8:40 am
Profile
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
When CS/programming is taught, the students are never taught to optimize. This is a huge failure since this problem becomes systemic and there are tons of programs produced that could be significantly faster than what was written for it. I could easily point to games being a culprit, but an even more pratical example is the freaking word processor. When you think about load times, you shouldn't be requires to beef up your computer massively just to get Word running better. It makes absolutely no sense to me. Something like Word should load up as fast as Notepad, but that simply is not the case. Maybe it seems that I'm asking for a lot, but considering that it shouldn't consume insane resources or insane CPU just to write up a document. Is that asking too much? I don't think so.


I 100% agree. Way too much stuff these days is either bloated, unoptimized, or both. Like Word 2003. Its utterly insane, same with loads other apps I use daily, like Visual Studio 2008. We really don't need the bloat. I just wish the devs just wake up and do something about it.

Note: I am not saying BSNES is either those 3 things (bloated/unoptimized/or both).


Tue Aug 05, 2008 9:42 am
Profile
Regular

Joined: Sat Mar 04, 2006 3:17 pm
Posts: 307
Post 
I completely agree

We should start a movement to teach the importance of optimization and commenting


Tue Aug 05, 2008 9:48 am
Profile
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
We should start a movement to teach the importance of optimization and commenting


Some people would get pissy if that happens. Namely Intel and co that earn money from bloat >.>


Tue Aug 05, 2008 10:06 am
Profile
Zealot

Joined: Tue Nov 27, 2007 7:03 am
Posts: 1325
Post 
Intel makes money off of everything. >.> bloated code, lean code, etc. If it runs faster on their platform/s, they make money off of it.


Tue Aug 05, 2008 10:16 am
Profile
Veteran

Joined: Wed Aug 04, 2004 5:43 pm
Posts: 861
Location: Sloop
Post 
mudlord wrote:
byuu,

http://mudlord.blogspot.com/2008/08/spe ... arity.html

There's my abbreviated response. I could have expanded a lot more, but I chose not to.

But basically, it shows the gist of what I think about optimization, and what I think of bloat & the relevance of optimization on ultra modern hardware.

Feel free to make a article as a rebuttal. I don't care.


It seems to me that optimization as a final stage will have a better end result faster than optimizing as you go due to code volatility. Maybe it doesn't matter so much with a word processor, but with an emulator, you're trying to duplicate something you're in a constant struggle to understand. If some optimizations have a chance of being scrapped along the way or are going to hinder the author's ability to troubleshoot newly discovered problems, then why bother?

At the same time, hacks of some parts (PPU) are practically necessary in order to even test games at full speed and improve other parts, or generate interest from people like DMV27 who otherwise may not have contributed fixes if the emulator provided no immediate prospects of enjoyment. There is clearly a mix of philosophies at work here, I have no idea why these types of threads persist. Microsoft's overly aggressive product intervals are bloat magnets. Office is as clear a case as you could want. But I don't consider that to be the reason that bsnes is slow. Sorry if you do.

AamirM wrote:
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.


And you'll find that nearly every time that happens, the original poster was suffering some major, irresolvable issue in their game. People suggest bsnes because it's easy. Got a problem? Bsnes probably doesn't have it. People know this by now, they don't have to go check equally uncertain alternatives every time someone moans that all their games are glitching out.


Tue Aug 05, 2008 10:25 am
Profile
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
t seems to me that optimization as a final stage will have a better end result faster than optimizing as you go due to code volatility. Maybe it doesn't matter so much with a word processor, but with an emulator, you're trying to duplicate something you're in a constant struggle to understand. If some optimizations have a chance of being scrapped along the way or are going to hinder the author's ability to troubleshoot newly discovered problems, then why bother?


I still feel though optimizing while going along instead of it being at the final stage is okay though. Sure its a choice some people make, but whatever works for them.


Quote:
I have no idea why these types of threads persist.


This one existed purely out of polarities between byuu and I. Honestly, sometimes I wish I wasn't here at this forum, because of all the fights and stuff. As honestly, I hate all the resentment and arguments, as it really gets to me. Sure people will just say "its just the internetz", but to some people, its more than that.


Tue Aug 05, 2008 10:37 am
Profile
Post 
Quote:
There's my abbreviated response. I could have expanded a lot more, but I chose not to.


Looks good to me, thanks for writing it :)

Quote:
And you'll find that nearly every time that happens, the original poster was suffering some major, irresolvable issue in their game.


All of the niceties (video filters, special chip support, etc) probably aren't helping the perception that it's not meant to compete / replace other emulators ... but I suppose if it increases the number of people testing games, that's probably a good thing.

Quote:
It seems to me that optimization as a final stage will have a better end result faster than optimizing as you go due to code volatility.


That's pretty much my entire point. Get it right first, optimize it later. It's just that "right" to me, for this specific program, means perfect, and that's not possible ;)

Quote:
I still feel though optimizing while going along instead of it being at the final stage is okay though. Sure its a choice some people make, but whatever works for them.


Yes, precisely, a choice. I certainly don't mind if people optimize as they go along.

Quote:
This one existed purely out of polarities between byuu and I.


The sad part is that I don't really even think we disagree. Like politicians, we just have two ways of saying the same thing.

Yes, I certainly appreciate optimized code and think it has a lot of value. And in 99.9% of cases, I agree with your approach. I also agree that VS2k8 and Word are ungodly slow, and there's not much excuse for that. Especially considering those products cost money. I hate the fact that even the "runs on legacy hardware" major Linux distros consume all available RAM on my 512MB machines, unless I go with Xfce.

I even agree with you for writing general emulators, even accuracy-focused ones. But I want to do something different: a niche of a niche, I want the code to be self-documenting so that other emulators can implement my findings. And they do, see zones' additions to IRQ timing in SNES9x for but one example. Really, that's my #1 goal -- I'm not worried about speed because I'm not aiming for people to play it. It's just that I kind of need people to in order to find bugs and such.

It's a truly exceptional case to the rule is all. If you look at my other software, you'll find it may not be the fastest, but it's quite fast in general. xkas can assemble ~200kb of source in less than 1/10th of a second. Der Langrisser uses all kinds of tricks to increase speed (like a vblank polling routine that checks latch ranges to avoid an extra frame seek if we're already in vblank -- something I've never seen anyone else do), etc. Unlike many fan translations, there's no visible slowdown compared to the original.

But I don't even ask that anyone agrees with my approach here, just that they respect it, as it's what I want to do personally.

Quote:
Honestly, sometimes I wish I wasn't here at this forum, because of all the fights and stuff.


Not to add insult to injury, but in the interest of fairness -- you were the one who brought this up in the first place :/
I'm sure I've started others though.

I agree though that's it getting old. Let's both try to be nice, even if we disagree -- we can at least respect that the other can do whatever he wants with his project and should be able to do without criticism. And if one of us starts bickering here, we'll have FitzRoy delete all of said posts. Sound good? :)


Tue Aug 05, 2008 11:45 am
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
Looks good to me, thanks for writing it :)


No probs. :) Least I got my main point across in how I approach things.



Quote:
The sad part is that I don't really even think we disagree. Like politicians, we just have two ways of saying the same thing.


Yes, and then that leads to all the bickering and stuff. Which isn't nice for both of us, considering we do get along. Its only when the contentious issues start that problems get abound. :(

Quote:
Yes, I certainly appreciate optimized code and think it has a lot of value. And in 99.9% of cases, I agree with your approach. I also agree that VS2k8 and Word are ungodly slow, and there's not much excuse for that. Especially considering those products cost money. I hate the fact that even the "runs on legacy hardware" major Linux distros consume all available RAM on my 512MB machines, unless I go with Xfce.


Exactly. If I was paying for a product, I would expect it to run well, and be optimized for such. And the software devs around that charge for bloated POS'es of software really don't deserve the money.

As for the Linux comment I agree. Fluxbox for me works equally well to Xfce. :P I honestly don't care for looks in GUIs, just functionality. So I really don't see the point in Aero, Compiz Fusion and stuff....



Quote:
But I want to do something different: a niche of a niche, I want the code to be self-documenting so that other emulators can implement my findings. And they do, see zones' additions to IRQ timing in SNES9x for but one example. Really, that's my #1 goal -- I'm not worried about speed because I'm not aiming for people to play it. It's just that I kind of need people to in order to find bugs and such.


Ah I see...so thats why theres not much commenting in the BSNES source...Still I think code commenting is nothing bad. :P

Quote:
I agree though that's it getting old. Let's both try to be nice, even if we disagree -- we can at least respect that the other can do whatever he wants with his project and should be able to do without criticism. And if one of us starts bickering here, we'll have FitzRoy delete all of said posts. Sound good? :)


Sound perfect to me. :)


Tue Aug 05, 2008 12:57 pm
Profile
Romhacking God

Joined: Wed Jul 28, 2004 11:27 pm
Posts: 922
Post 
I'm going to play devil's advocate here. You two love to throw around Word and Visual Studio as your examples of unoptimized, bloated programs. However, do you really know this to be true? With all the features in Visual Studio 2008 and Word, do you really think you could create something better? There's just no backing substance to your claims other than the programs are slow in loading. You have no idea why they are slow nor how they could be improved.

I'm not agreeing nor disagreeing with whether or not they are bloated. Just throwing out the fact that these claims seem frivolous to use as supporting evidence of your opinion of poor software design without backing. ;)

P.S. Notepad is slow as hell to open and do anything with large files. That doesn't win any awards for speed in my book either.

_________________
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.


Tue Aug 05, 2008 1:24 pm
Profile WWW
has wat u liek
User avatar

Joined: Tue Sep 11, 2007 2:54 pm
Posts: 559
Location: Banland.
Post 
Quote:
I'm going to play devil's advocate here. You two love to throw around Word and Visual Studio as your examples of unoptimized, bloated programs. However, do you really know this to be true? With all the features in Visual Studio 2008 and Word, do you really think you could create something better? There's just no backing substance to your claims other than the programs are slow in loading. You have no idea why they are slow nor how they could be improved.


That same logic applies to Windows Vista too.


Quote:
However, do you really know this to be true?

More often than not, there is criteria for bloated software. Like
* Large harddrive footprint
* Large RAM requirements
* Large CPU requirements

VS2008 takes up all 3, not to mention the MSDN Library, which adds another 2-3GB.

Yes its all subjective, but there are some common attributes of "bloated" software. And MS often calls thier extra bloated things added "features".


Tue Aug 05, 2008 1:44 pm
Profile
Lurker

Joined: Thu Jul 24, 2008 1:29 pm
Posts: 113
Post 
Quote:
As for the Linux comment I agree. Fluxbox for me works equally well to Xfce. :P I honestly don't care for looks in GUIs, just functionality. So I really don't see the point in Aero, Compiz Fusion and stuff....


I see a point in Aero, which I think is very important - as the whole desktop environment is hardware accelerated by the video card and it's done really nice, you DON'T have any visual tearing when moving windows, or which is the most important, scrolling. Combining this with ClearType makes life for my eyes much easier (using TN panel) :). Please show me other systems with such behaviour, so I can stop using Vista.


Tue Aug 05, 2008 3:01 pm
Profile
Post 
Quote:
Ah I see...so thats why theres not much commenting in the BSNES source...Still I think code commenting is nothing bad.


Code:
/*****
 * One PPU dot = 4 CPU clocks
 *
 * PPU dots 323 and 327 are 6 CPU clocks long.
 * This does not apply to NTSC non-interlace scanline 240 on odd fields. This is
 * because the PPU skips one dot to alter the color burst phase of the video signal.
 *
 * Dot 323 range = { 1292, 1294, 1296 }
 * Dot 327 range = { 1310, 1312, 1314 }
 *****/


  //dram refresh occurs once every scanline
  status.dram_refreshed = false;
  if(cpu_version == 2) status.dram_refresh_position = 530 + 8 - dma_counter();

  //hdma triggers once every visible scanline
  status.line_rendered  = false;
  status.hdma_triggered = (status.vcounter <= (ppu.overscan() == false ? 224 : 239)) ? false : true;

  //interlaced even fields have one extra scanline (263+262=525 NTSC, 313+312=625 PAL)
  if(ppu.interlace() == true && ppu.field() == 0) status.field_lines++;

  //H/DMA pending && DMA inactive?
  //.. Run one full CPU cycle
  //.. HDMA pending && HDMA enabled ? DMA sync + HDMA run
  //.. DMA pending && DMA enabled ? DMA sync + DMA run
  //.... HDMA during DMA && HDMA enabled ? DMA sync + HDMA run
  //.. Run one bus CPU cycle
  //.. CPU sync

/*****
 * last_cycle()
 *
 * Used to test for NMI/IRQ, which can trigger on the edge of every opcode.
 * Test one cycle early to simulate two-stage pipeline of x816 CPU.
 *
 * status.irq_delay is used to simulate hardware delay before interrupts can
 * trigger during certain events (immediately after DMA, writes to $4200, etc)
 *****/
  //initial latch values for $213c/$213d
  //[x]0035 : [y]0000 (53.0 -> 212) [lda $2137]
  //[x]0038 : [y]0000 (56.5 -> 226) [nop : lda $2137]
  add_clocks(186);


I do try and comment where I can. Especially where something can be misconstrued as a bug.

But take things like this for instance:

Code:
//DMAEN
void sCPU::mmio_w420b(uint8 data) {
  for(unsigned i = 0; i < 8; i++) {
    channel[i].dma_enabled = data & (1 << i);
  }
  if(data) status.dma_pending = true;
}


Anyone with a brain can tell if(data) means if(any DMA channels are actually active). I suppose I could add comments to that, but really ... it takes half a second to see it. If you can't, maybe you shouldn't be messing around with a SNES emulator :P

One problem is that it's really difficult to explain a lot of the really complex stuff in comments.

For instance, take a look at the recent HDMA findings thread. It would suck to have a 10-paragraph explanation of how DMA sync works alongside ~6 lines of actual code. It would make editing the code hard when it's immersed in an ocean of comments :P

What I really need is to write up real external documentation, and reference that in the code.

"DMA sync code. See /doc/s-cpu/dma.pdf for basic outline."

It would also be nice if there were some sort of universal standard for a "collapsed by default" comment, so you just get a little "?" box or something to hit if you want to see the long dissertation comments.


Tue Aug 05, 2008 5:24 pm
ZSNES Developer
ZSNES Developer

Joined: Tue Dec 28, 2004 6:47 am
Posts: 6747
Post 
Nightcrawler wrote:
I'm going to play devil's advocate here. You two love to throw around Word and Visual Studio as your examples of unoptimized, bloated programs. However, do you really know this to be true? With all the features in Visual Studio 2008 and Word, do you really think you could create something better? There's just no backing substance to your claims other than the programs are slow in loading. You have no idea why they are slow nor how they could be improved.


I didn't throw out VS, but I wonder how much stuff has to be loaded so it's happy.. not that it actually matters when time is spent compiling and debugging, that those minor things can be sped up and be helpful is always welcomed.

Quote:
I'm not agreeing nor disagreeing with whether or not they are bloated. Just throwing out the fact that these claims seem frivolous to use as supporting evidence of your opinion of poor software design without backing. ;)


I guess it depends more on the primary usage of the app. If you only use 10% of an app's features and that app consumes 1GB, you wonder if you spent that space wisely. If the app is like 2MB but its feature filled, noone tends to notice this extra stuff as bloat.

Quote:
P.S. Notepad is slow as hell to open and do anything with large files. That doesn't win any awards for speed in my book either.


Oh, I'm very aware of that.. I'm only referring to a simple "open app" case than a "open huge file" case. It's woefully insufficient but then again, you shouldn't expect to use it for that purpose in the first place...

_________________
Continuing FF4 Research...


Tue Aug 05, 2008 7:55 pm
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Post 
If you want to determine if an app is bloated as defined above, it's easy to see by comparing to the competition. If the competition has a similar feature set but is a 10th the size, loads instantly, and works on slow CPUs, you have an indicator right there.

Most office applications today by the big companies ARE bloatware.

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Tue Aug 05, 2008 8:00 pm
Profile WWW
New Member

Joined: Mon Feb 25, 2008 5:21 am
Posts: 9
Post 
I'd say the perfect example of an all around well-written app is uTorrent. A nice-looking, fairly feature-filled torrent client; yet, it pops up literally at the snap of a finger, even on a *cold* start. And the standalone .exe is very tiny.

If only more software were written like that.


Wed Aug 06, 2008 7:58 am
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.