Gbc games made in C slow?
I plan on making gameboy color games. I have made one in C using GBDK. How good is the GBDK C compiler because some people have said that gbc games made in C are much slower than the games made in assembly. Would the GBDK C compiler be able to produce games that are as fast or almost as fast as the assembly compiler.
Comments
Originally posted by: 3GenGames
You can use C, but it will never be in the same league as games made in assembly, never. Look at the C made NES games. Plus, when you need to mark carts, there'll be huge bloat, but probably never enough to make it not worth it when making carts, more so with processor power being eaten up.
Not entirely true. It all depends on how you optimize the code and remove parts of libraries that you aren't using. There may be very little bloating, and very little optimization required, depending on what you're doing and how you're doing it.
Yes, ASM is faster since it's direct machine language, but not everyone wants to waste time learning a language that can't be used in real world solutions.
Originally posted by: dra600n
Yes, ASM is faster since it's direct machine language, but not everyone wants to waste time learning a language that can't be used in real world solutions.
And that's a bold statement considering how many products out there are made 100% with embedded processors. Everywhere there is a 44780 display, there is almost garunteed a PIC/AVR/Z80 close by. A lot of those are still programmed in assembly to buy smaller chips instead of wasting the resources to be able to make the product cheaper when you build them by the thousands. Assembly in that field is huge and what I plan on going in to. Yeah, you won't make a AAA game in assembly today for obvious reasons, but assembly is still immensly useful.
And C will always have bloat, you can try to minimize it, but a solid fact is that it will never, ever be faster than good assembly code written by a human.
Most ASM programmers today are the ones who directly work with the initial hardware, and that's it. It's a dying language for the masses. You'd be hard pressed to find a job as an assembly programmer than a C/C++/Visual Basic developer.
Ever program in C/C++ other than "Hello world"? Ever dig through the libraries and remove functions that you won't ever use? Until you've had some actual experience with other languages, then you should really stop fluffing your posts with random stuff. Yes, there will be *some* bloat, but if you know what you're doing, it will be very minimal.
Originally posted by: dra600n
Yes, ASM is faster since it's direct machine language, but not everyone wants to waste time learning a language that can't be used in real world solutions.
There are FAR more microcontrollers that use ASM than there are processors that use C. Cars are starting to get into the hundreds of processors.
Originally posted by: 3GenGames
And C will always have bloat, you can try to minimize it, but a solid fact is that it will never, ever be faster than good assembly code written by a human.
A human cannot optimize for a modern processor, or even one with a significant number of registers. Your ASM code will not be able to handle branch prediction, out of order execution, cache coherency, super scalar execution, pipeline stalls, etc etc etc etc.
Originally posted by: bunnyboy
Originally posted by: dra600n
Yes, ASM is faster since it's direct machine language, but not everyone wants to waste time learning a language that can't be used in real world solutions.
There are FAR more microcontrollers that use ASM than there are processors that use C. Cars are starting to get into the hundreds of processors.
Originally posted by: 3GenGames
And C will always have bloat, you can try to minimize it, but a solid fact is that it will never, ever be faster than good assembly code written by a human.
A human cannot optimize for a modern processor, or even one with a significant number of registers. Your ASM code will not be able to handle branch prediction, out of order execution, cache coherency, super scalar execution, pipeline stalls, etc etc etc etc.
Don't most companies give dev tools to their 3rd party developers so they don't have to use ASM and instead use a higher level language to increase production on their softwares? You're not going to design a microprocessor and expect <<insert your partner companies who develop for your platform>> to learn/use ASM when it takes a lot more code, and the simplest mistake could take forever to find and troubleshoot.
~40 current job openings at Apple headquarters alone where assembly knowledge is required or preferred. How "real world" is that? This one looks fun, but I only have about half that stuff! http://www.google.com/about/jobs/locations/mountain-view/engineering/hardware/hardware-engineer-google-fiber-mountain-view.html
You claimed assembly can't be used in the real world, not that anyone can find a job using it wherever they live. I am certainly not saying someone should only learn assembly and ignore c, but why would you purposely limit your potential job search pool by ignoring something important for higher level development too?
on Careerbuilders.com:
530 ASM jobs are available across the US. Averaging about 10 or less per state, with California and Washington state being the top contenders.
1,288 Visual Basic jobs across the US.
2,306 for C++
11,236 for C (this search might include C++ as well, but that's still 10,930 more jobs that just C++)
1,494 for php
And just for kicks, I searched for SQL: 14,030. Granted there's more to it than just scripting, but that's still a HUGE part of it, so I'm tossing it in.
Take C, C++, and PHP (they're all very similar languages), and you get 15,036 jobs over the 530. That's a 28:1 ratio for C variant to ASM programmers (from careerbuilders.com). Yes, there are jobs out there, but they're more difficult to come by.
Compared to other languages, how would that be widely available Nathan? And not to say people would move for those jobs, because some would, but would you be willing to give up friends and family for a higher paying job in a higher cost of living area where the pay increase may not really be a pay increase after all the inflated expenses? If someone were to just pack up and move without research and actual thought behind their decision, it doesn't seem like they have a sound mind for making large decisions.
Originally posted by: dra600n
If someone were to just pack up and move without research and actual thought behind their decision, it doesn't seem like they have a sound mind for making large decisions.
I'm not suggesting a person would move before they had an offer. That would be ill thoughtout.
But tons of people move for professional reason, all the time. It is not rare. It is not even uncommon.
I know very few people that live in the same town as the rest of their family (excluding spouses and children, obviously).
You are putting words in my mouth if you think I was suggesting people would just go to a place without research or real prospects.
Just because a person would need to do due diligence, does not mean the opportunities are not "widely available" (and I don't think anybody implied that there were more ASM jobs than C/C++ jobs... both are "widely available" IMO)
I think we must have different opinions of what that term implies.
Moving to a different part of the state is different than moving to another state, or across country, for a job. I don't live in the same town I grew up in, and I don't work in the same town I live in. That's not a big change or risk. Moving to another state, even if you had the job offer, requires plenty of due diligence before moving. I know a few people who have done that, and they ended up moving back, and I know a few people who have done it, and have been in another state ever since, though they miss their friends and families, and don't have much time to take a trip back "home".
That said, I'm sure there are thousands of ASM programmers. Whether they can actually code in ASM or require their hand held by forums, is another story, and if they know how to write a resume, would saturate the market and make it much, much more difficult to acquire a job in that type of position. Going by Career Builders search results (I spoke too soon when I said there weren't any ASM positions here, which... they aren't advertised in the newspapers or other means of local job opportunities), there are 6 positions available. Suppose (hypothetical situation), there are 100 talented ASM programmers in my state (believable, not highly unlikely or anything, and I'm sure there are more than 100), but only 6 jobs. How is that widely available? In every state, I believe Cali had 50 or 60 positions opened up (most by Apple), how is that widely available? Even if they were willing to move for the new position, there will be other people applying for the job as well in those states.
Now, maybe in the upcoming generation shift, more positions will become available since I doubt ASM developers are likely to give up their lucrative career, but right now, I wouldn't say those positions are widely available.
It is not uncommon, at all, in our generation. And in fact, is required for quite a few disciplines.
I'm sorry it's worked out poorly for the people you know, but in my experience that's the exception, rather than the rule.
Honestly, it's weird to me to keep up with more than a friend or two from HS, and a few friends from college.
We make new friends in our new adopted hometown, and we see family a couple times a year. I love my family, but that is plenty of face-to-face time, with so many means of communication available.
Then again, that's how I grew up, with my parents having moved 600+ miles from their respective hometowns, and us just driving to see extended family once a year at Christmas.
My impression would be that they can't fill the slots they have, so they are readily available to anybody that can prove they are competent to do the job.
Originally posted by: dra600n
I'm not saying ASM isn't worth knowing, but it's not widely as used as other languages these days.
Originally posted by: dra600n
not everyone wants to waste time learning a language that can't be used in real world solutions.
So now its worth knowing, but not in the real world? "Not as widely used" is far different from "can't be used". Maybe you just wanted to exaggerate to try to make your point better?
Originally posted by: bunnyboy
Originally posted by: dra600n
I'm not saying ASM isn't worth knowing, but it's not widely as used as other languages these days.
Originally posted by: dra600n
not everyone wants to waste time learning a language that can't be used in real world solutions.
So now its worth knowing, but not in the real world? "Not as widely used" is far different from "can't be used". Maybe you just wanted to exaggerate to try to make your point better?
More or less. I don't think learning any language is pointless, each one has their uses, but unless you're a real exceptional ASM programmer, you're not going to use it in the real world. I'd feel confident to say that anyone who learns ASM to develop homebrew games won't get a job working with ASM, unless they go past game development and learn how to optimize and write efficient code, and even then, it would be a slim chance that they would be able to acquire such a position.
That was what I was trying to say. Obviously internal production on products that use microprocessors use ASM at the core, but they also give developers SDK's that expand away from ASM, so there's very little gain in learning ASM in terms of a career, unless you're end goal is to work with microprocessors, and again, the positions aren't highly available. Though, with the current generation of people who are about to retire, jobs could possibly open up and thousands of ASM jobs may be available. Right now, though, it's not that way.
Back on topic a bit, you can also use inline assembly in C, so if your application has specific tasks that need performance tuning, it is also an option to combine the two.
There is other GB/GBC specific thing that some may consider important, though - power saving. Compiled C code will consume more power, because you will have less free CPU time to keep in a low power consumption state.