View unanswered posts | View active topics It is currently Mon May 20, 2019 2:57 pm



This topic is locked, you cannot edit posts or make further replies.  [ 83 posts ]  Go to page Previous  1, 2, 3, 4
How other people should write their software 
Author Message
Post 
I agree with the example on uTorrent. I'll also agree with Visual Studio being a wonderful piece of bloatware; you only have to use it to see how sluggish it can be, especially for what it does -- and what it does that it certainly has no need of.

I have a tendency to write in an accusatory manner, so you'll have to excuse me on that, but I'm taking both sides here.

At once, I have a border line OCD tendency to write "correct" code, so that it does what it's supposed to do in the most correct fashion (it works against me a lot) and then go about optimizing it. Each processor in the SNES being a separate thread certainly seems to be the most correct way to emulate the system, but I wasn't aware of the huge problem of thread synchronization (I read the other thread about save states).

Tthere are still the "classic" emulators, ZSNES and Snes9x, both of which
are already incredibly fast. Like someone else said, you've got a choice. There's no point writing another ZSNES/Snes9x, because they're already there. I haven't looked at the BSNES code but if he optimized as aggressively as some suggest, he might as well drop the project. It has a different goal, so let it be.

On the other hand, I also have a huge tendency to want code to be fast, no matter the application, and violated my own principles at my last job due to the fact that they didn't care about speed nearly at all. Stuff like:

Code:
int a = 0;
a += 10;
for(int i; i < a; i++)


should certainly be changed, but I'm assuming the optimizations in BSNES aren't on the order of that kind of silliness. Besides, there are other kinds of optimizations: BSNES should scale well on multi-core processors. That said, the thing is pretty slow even given modern processors. PCSX2, an emulator for a much more powerful machine, can run nearly full speed on top of the line PCs. I was looking at task manager and watching none of my 4 cores top out above maybe 25% usage, and still the emulation was slow.


Tue Jan 20, 2009 11:44 am
Seen it all
User avatar

Joined: Mon Jan 03, 2005 5:04 pm
Posts: 2302
Location: Germany
Post 
Mystiq wrote:
Stuff like:

Code:
int a = 0;
a += 10;
for(int i; i < a; i++)

should certainly be changed


But only for the aesthetics. A compiler worth its usage optimizes it by its own.

Mystiq wrote:
PCSX2, an emulator for a much more powerful machine, can run nearly full speed on top of the line PCs.

The power of the emulated machine is only one part of the equation.

Mystiq wrote:
I was looking at task manager and watching none of my 4 cores top out above maybe 25% usage, and still the emulation was slow.

Setting the thread affinity to one core might be better for the caches.

_________________
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list


Tue Jan 20, 2009 12:38 pm
Profile WWW
Regular
User avatar

Joined: Tue Mar 07, 2006 10:32 am
Posts: 347
Location: The Netherlands
Post 
Mystiq wrote:
BSNES should scale well on multi-core processors.

bsnes uses libco for multithreading due to the amount of context (thread) switches it needs to do every second. Switching between and synchronizing to a different physical processor core is a relatively slow process, which would negate the advantages of libco even if the library -was- designed to access more than one core, and so the core emulation cannot currently take advantage of multicore processors.


Tue Jan 20, 2009 3:22 pm
Profile
Regular
User avatar

Joined: Tue Mar 07, 2006 10:32 am
Posts: 347
Location: The Netherlands
Post 
Oh, right. No edits.

This may or may not change in future processor architectures, however the current mindset seems to be that if you need that many context switches per second, 'you're doing it wrong' (ignoring bsnes' admittedly niche situation) so don't hold your breath.


Tue Jan 20, 2009 3:25 pm
Profile
Post 
Oh god.....I thought this discussion was done and dusted. :( Why did it have to be brought up again? Basically, I thought byuu and I now agree on things, and now the issue has been brought up, again after a period of silence and zero arguments?

Plus: byuu and I both know BSNES is slow :P (no offense byuu, I recall you saying it is on occasions). IMHO, if you though want a nice, accurate emu with a nice degree of speed also, SNESGT is a good bet :). Though ZSNES v2 if you are willing to wait might have some surprises also.


Tue Jan 20, 2009 4:48 pm
Post 
Quote:
Oh god.....I thought this discussion was done and dusted. Sad Why did it have to be brought up again?


Yet another thing we agree on ;)

Quote:
BSNES should scale well on multi-core processors.


As it stands, it gets 60fps on the fastest single cores out there. Only the cheapest dual cores have trouble maintaining full speed (even an E2180 can manage.)

We would also need at least four cores, five if you want SuperFX / SA-1 support. Once even low end systems have this, it may well be worth considering. It would also require really fast, highly portable primitives for thread synchronization, eg InterlockedExchange, etc.

It also won't scale linearly. You'll be taxing more cores for smaller gain. The net effect will be more power wasted.

Quote:
PCSX2, an emulator for a much more powerful machine, can run nearly full speed on top of the line PCs.


UltraHLE can run N64 games on a 300MHz system, faster than even ZSNES runs "10MHz" SA-1 games. And how precise do you think they are? :)

A better question is how precise do they need to be / can be realistically attained?

Quote:
I was looking at task manager and watching none of my 4 cores top out above maybe 25% usage, and still the emulation was slow.


One of your cores was at 100%, three were idle. That's the way task manager reports CPU usage. By slow, do you mean less than full speed? If so, something else is probably wrong.


Tue Jan 20, 2009 5:09 pm
Locksmith of Hyrule
User avatar

Joined: Sun Aug 08, 2004 7:49 am
Posts: 3634
Location: 255.255.255.255
Post 
h4tred wrote:
Oh god.....I thought this discussion was done and dusted. :( Why did it have to be brought up again? Basically, I thought byuu and I now agree on things, and now the issue has been brought up, again after a period of silence and zero arguments?

I concur.

*crush*

_________________
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 Jan 20, 2009 6:41 pm
Profile YIM WWW
Veteran

Joined: Wed Aug 04, 2004 5:43 pm
Posts: 861
Location: Sloop
Post 
I mostly watched this thread from the sidelines, and I just want to add a simple observation before it dies. 100% playback accuracy is incredibly more demanding than 98%. With range-tested IRQs, random ass games were breaking. With an opcode sound core, random ass games were breaking. If it was only stupid golf games that were breaking, maybe it would be worth the speed advantage. But it wasn't. R-Type III was breaking, Secret of Mana was breaking. A lot of people making criticisms weren't here for that. They weren't here to see byuu going mad trying to find a way to get every edge case in a 3000 game library pass simultaneously. It's not style and little snippets of code that makes bsnes 50% slower than it used to be, it is much more fundamental than that. As if any of this is even going to matter in a few years, computers are always getting faster and cheaper.


Tue Jan 20, 2009 10:57 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

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.