• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 08:27
CEST 14:27
KST 21:27
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy18ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
$5,000 WardiTV TLMC tournament - Presented by Monster Energy2GSL CK: More events planned pending crowdfunding3Weekly Cups (May 30-Apr 5): herO, Clem, SHIN win0[BSL22] RO32 Group Stage4Weekly Cups (March 23-29): herO takes triple6
StarCraft 2
General
Quebec Clan still alive ? BGE Stara Zagora 2026 cancelled Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Weekly Cups (May 30-Apr 5): herO, Clem, SHIN win Rongyi Cup S3 - Preview & Info
Tourneys
Sea Duckling Open (Global, Bronze-Diamond) Sparkling Tuna Cup - Weekly Open Tournament GSL CK: More events planned pending crowdfunding $5,000 WardiTV TLMC tournament - Presented by Monster Energy RSL Season 4 announced for March-April
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power Mutation # 518 Radiation Zone
Brood War
General
BW General Discussion ASL21 General Discussion so ive been playing broodwar for a week straight. Gypsy to Korea Pros React To: JaeDong vs Queen
Tourneys
Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro24 Group F [BSL22] RO32 Group B - Sunday 21:00 CEST
Strategy
Fighting Spirit mining rates Muta micro map competition What's the deal with APM & what's its true value Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread General RTS Discussion Thread Starcraft Tabletop Miniature Game Nintendo Switch Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread The China Politics Thread European Politico-economics QA Mega-thread Trading/Investing Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How Streamers Inspire Gamers…
TrAiDoS
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
StarCraft improvement
iopq
Electronics
mantequilla
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2104 users

The Big Programming Thread - Page 333

Forum Index > General Forum
Post a Reply
Prev 1 331 332 333 334 335 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Holy_AT
Profile Joined July 2010
Austria978 Posts
July 31 2013 12:41 GMT
#6641
EscPlan9 I urge you to not take a job at a help desk if your education enables you to work as a junior developer (at least that's what I am guessing you wanna do). Only do this if you have absolutely no choice and you have to be flexible and mobile, just sticking in your home town or district wont do it in most of the cases.
And although some people may tell you differently, programming/software development is not a high payed work unless you are in a management or leading position or if you are fluent in some obscure language that no one can master anymore.
And simple programming jobs are often being offshore to India where they can have 10 Indians solving a problem instead of you.

When you go to an interview tell them about your knowledge your experience, even tell them that you have basic knowledge in this and that language although you just peeked at it for one week. An interview is a circus show where the possible future employee comes nicely dressed and tells the future employer about stuff he knows or ought to know and the employer tells the employee how cool and grand his enterprise/cooperation whatever is although hey are not.
An interview is just a dumb game a show wit no real value but real consequences. And do not undersell yourself ever because if you pick a minimum wage the employer will always go for it, nearly no employer wil say to you: Well that's not enough we ought to pay you more. Always aim higher and when its to high, you still can aim lower a bit.
But if you generally aim low and hit, it is damn hard to get i higher.
gedatsu
Profile Joined December 2011
1286 Posts
July 31 2013 12:49 GMT
#6642
On July 31 2013 21:18 darklordjac wrote:
Sorry if this question has been asked and answered before in this thread (which it probably has) but I want to learn to code but not really sure on which language I should start with. Now I am not a complete noob as I have learned some basic python, which was fun and all but just didn't like how it seemed to do everything for you if that makes sense. I also completed two high school computer science classes in which we used java.

I was thinking C, thoughts? Or would I be better off with learning a higher level language first and than moving onto the "harder" stuff like C first? Or does it not matter?

You would be better off with a higher level language first. I don't recommend C to beginners, as it forces you to think about memory layout when you just want to make the computer do stuff.

But you have said that you already know two higher languages. If you feel at all comfortable with Java, then go ahead and dig into C. I've never tried Python so I don't know how it relates to C.
darklordjac
Profile Joined July 2010
Canada2231 Posts
July 31 2013 12:49 GMT
#6643
On July 31 2013 21:29 Holy_AT wrote:
Show nested quote +
On July 31 2013 21:18 darklordjac wrote:
Sorry if this question has been asked and answered before in this thread (which it probably has) but I want to learn to code but not really sure on which language I should start with. Now I am not a complete noob as I have learned some basic python, which was fun and all but just didn't like how it seemed to do everything for you if that makes sense. I also completed two high school computer science classes in which we used java.

I was thinking C, thoughts? Or would I be better off with learning a higher level language first and than moving onto the "harder" stuff like C first? Or does it not matter?


Don't think in terms of what language should I learn, But what problem do I ant to solve and then pick a language that is most likely an appropriate tool to solve it.

I started when I was young with basic then pascal, dipped a bit into c++ then Java and C# and because my Job requires it I am mainly programming in C#.


Hmmm well it would be for hobbies and nothing professional (I don't think). I was going to go into comp sci for university but I love chemistry and pharmacy too much.
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
July 31 2013 13:21 GMT
#6644
On July 31 2013 21:49 gedatsu wrote:
Show nested quote +
On July 31 2013 21:18 darklordjac wrote:
Sorry if this question has been asked and answered before in this thread (which it probably has) but I want to learn to code but not really sure on which language I should start with. Now I am not a complete noob as I have learned some basic python, which was fun and all but just didn't like how it seemed to do everything for you if that makes sense. I also completed two high school computer science classes in which we used java.

I was thinking C, thoughts? Or would I be better off with learning a higher level language first and than moving onto the "harder" stuff like C first? Or does it not matter?

You would be better off with a higher level language first. I don't recommend C to beginners, as it forces you to think about memory layout when you just want to make the computer do stuff.

But you have said that you already know two higher languages. If you feel at all comfortable with Java, then go ahead and dig into C. I've never tried Python so I don't know how it relates to C.


You really don't need to know much about memory to write some basic programs in C, I doubt he's going to pile into some highly complex, memory intensive software.

If you don't want the feeling of something 'doing everything for you' then definitely learn C, I'd do that in the context of your chosen OS, so if you work on Windows write something which traverses the file system, one of the things I first did in C was remake the 'browse' dialogue you get with many applications using a tree view control. It'll give you a good idea of how C works, introduce you to the Win32 API and show the joys (sarcasm) of COM.

C in itself isn't hard, I personally find a lot of higher level languages harder because of the larger libraries, dependencies and frameworks associated with them, they also have a lot more 'shiney' things you play around with that just add more confusion to a newcomer. C is simple and to the point, there really isn't much to learn about the language, you just get stuck in and learn systems instead which in my opinion is more interesting, it's also easier to debug your code when you aren't sitting atop of a bunch of DLL's you don't have access to.

People say C is hard only because it forces you to write properly and think about what you're doing, those who enjoy C would simply state that you should be doing this for any language but the more managed aspects mean you can fall into bad habits without really knowing why.

For simple home projects you'll find plenty of places, like here, where you can paste in small amounts of code and ask questions to get help so I wouldn't be afraid of it.
gedatsu
Profile Joined December 2011
1286 Posts
July 31 2013 13:39 GMT
#6645
You don't need to write highly complex memory intensive software to run into memory management. In Java, you create an object with new and that's that. It exists "somewhere" for as long as you need it to, and stops existing when you don't want it anymore. In C you need to decide if the data should be malloced or not, you need to decide whether a function takes a pointer or a piece of data, and you need to decide when to kill the data. It isn't terribly difficult, but can get in the way you are a total beginner. It did for me, and I avoided C for a long time after that.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
July 31 2013 13:56 GMT
#6646
On July 31 2013 21:49 darklordjac wrote:
Show nested quote +
On July 31 2013 21:29 Holy_AT wrote:
On July 31 2013 21:18 darklordjac wrote:
Sorry if this question has been asked and answered before in this thread (which it probably has) but I want to learn to code but not really sure on which language I should start with. Now I am not a complete noob as I have learned some basic python, which was fun and all but just didn't like how it seemed to do everything for you if that makes sense. I also completed two high school computer science classes in which we used java.

I was thinking C, thoughts? Or would I be better off with learning a higher level language first and than moving onto the "harder" stuff like C first? Or does it not matter?


Don't think in terms of what language should I learn, But what problem do I ant to solve and then pick a language that is most likely an appropriate tool to solve it.

I started when I was young with basic then pascal, dipped a bit into c++ then Java and C# and because my Job requires it I am mainly programming in C#.


Hmmm well it would be for hobbies and nothing professional (I don't think). I was going to go into comp sci for university but I love chemistry and pharmacy too much.


If you just want to make things happening and want to have quick results without caring about what happens behind the scenes, learn C#. It is a solid language and the .NET framework has a lot of utilities for basically everything you'd ever need. I've ported C programs to C# where 100+ lines of C were done with one line of C#/.NET.

If you really want to know what the PC does behind the scenes, you can learn C with the drawback of taking longer to actually get results.

Personally i think it's better to learn C# first because it's more fun to quickly have something that you can see and interact with. Creating a simple game with a nice GUI takes barely any effort and that is what keeps people interested in programming. Doing something similar in C requires a lot more research, know-how and time and most people give up before they have something complete because it's mostly just boring.
Holy_AT
Profile Joined July 2010
Austria978 Posts
July 31 2013 16:41 GMT
#6647
On July 31 2013 21:49 gedatsu wrote:
Show nested quote +
On July 31 2013 21:18 darklordjac wrote:
Sorry if this question has been asked and answered before in this thread (which it probably has) but I want to learn to code but not really sure on which language I should start with. Now I am not a complete noob as I have learned some basic python, which was fun and all but just didn't like how it seemed to do everything for you if that makes sense. I also completed two high school computer science classes in which we used java.

I was thinking C, thoughts? Or would I be better off with learning a higher level language first and than moving onto the "harder" stuff like C first? Or does it not matter?

You would be better off with a higher level language first. I don't recommend C to beginners, as it forces you to think about memory layout when you just want to make the computer do stuff.

But you have said that you already know two higher languages. If you feel at all comfortable with Java, then go ahead and dig into C. I've never tried Python so I don't know how it relates to C.


In that case I'd also recommend c#.
Get the visual studio express edition, its for free and you can build simple programs with gui very fast and there are plenty of tutorials and websites around to get you up to speed.
You also don't have to worry about memory management.
As an alternative you could try java.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-07-31 16:46:07
July 31 2013 16:45 GMT
#6648
On July 31 2013 21:41 Holy_AT wrote:
And although some people may tell you differently, programming/software development is not a high payed work unless you are in a management or leading position or if you are fluent in some obscure language that no one can master anymore.
And simple programming jobs are often being offshore to India where they can have 10 Indians solving a problem instead of you.

When you go to an interview tell them about your knowledge your experience, even tell them that you have basic knowledge in this and that language although you just peeked at it for one week. An interview is a circus show where the possible future employee comes nicely dressed and tells the future employer about stuff he knows or ought to know and the employer tells the employee how cool and grand his enterprise/cooperation whatever is although hey are not.
An interview is just a dumb game a show wit no real value but real consequences.

This is a very jaded view, and not at all accurate for the industry as a whole. I guess it depends on your definition of "high paid work", but basically every single one of the classmates I was close with in Uni is now making >50k base, which is not bad. Some are making considerably more, and none are in any kind of management or leading position (due to inexperience and general distaste for management ).

It may be true that in a particular physical location there are not many high paying software engineering jobs, but that does not mean the industry as a whole is the shit you're describing. That's just patently false.


And yes, there are problems with the interview process at many companies, but it's not always gonna be what you describe. In many places the interview process is a technical evaluation, wherein the company tries to make sure future employee is good at basic problem solving, communication, and programming. And both future employee and interviewer may not be wearing shoes, let alone be nicely dressed. (Or in the case of one of my interviewers, the dude showed up in a bathrobe, and proceeded to ask me tons of cool questions about weirdly performing tree structures).

Also as a side note, while interviewers will ask you questions about your previous work, they typically can't go into too much detail because 1) a lot of people are not at liberty to discuss the finer details of their previous programming work (as it's the property of their previous company) and 2) it's hard to get a good signal from someone abstractly talking about their previous work - unless you can get into a lot of nitty detail about exact problems they solved, you're much better off asking technical questions to get a signal as to whether or not they know how to solve problems & code.

Holy it sounds like the places you've applied to are not very fun places to work, and that's unfortunate, but you shouldn't try to paint the entire industry with that brush.

The advice about not voluntarily giving a low salary number is really good though, definitely a bad move to do that.
Who after all is today speaking about the destruction of the Armenians?
RedDeckWins
Profile Joined December 2010
United States123 Posts
July 31 2013 17:08 GMT
#6649
On July 31 2013 21:41 Holy_AT wrote:
EscPlan9 I urge you to not take a job at a help desk if your education enables you to work as a junior developer (at least that's what I am guessing you wanna do). Only do this if you have absolutely no choice and you have to be flexible and mobile, just sticking in your home town or district wont do it in most of the cases.
And although some people may tell you differently, programming/software development is not a high payed work unless you are in a management or leading position or if you are fluent in some obscure language that no one can master anymore.
And simple programming jobs are often being offshore to India where they can have 10 Indians solving a problem instead of you.

When you go to an interview tell them about your knowledge your experience, even tell them that you have basic knowledge in this and that language although you just peeked at it for one week. An interview is a circus show where the possible future employee comes nicely dressed and tells the future employer about stuff he knows or ought to know and the employer tells the employee how cool and grand his enterprise/cooperation whatever is although hey are not.
An interview is just a dumb game a show wit no real value but real consequences. And do not undersell yourself ever because if you pick a minimum wage the employer will always go for it, nearly no employer wil say to you: Well that's not enough we ought to pay you more. Always aim higher and when its to high, you still can aim lower a bit.
But if you generally aim low and hit, it is damn hard to get i higher.


I would like to re-iterate that this is completely incorrect in my experience. Just as with any job, if you aren't very good you won't get paid very much, and you are replaceable. However, even if you are an average programmer you will be pulling in 70k MINIMUM if you are working in the right market (New York, Boston, Seattle, Silicon Valley).

Every company is looking for good programmers. If you are good the sky is the limit and there are tons of opportunities.
EscPlan9
Profile Blog Joined December 2006
United States2777 Posts
Last Edited: 2013-07-31 17:13:18
July 31 2013 17:12 GMT
#6650
On July 31 2013 21:41 Holy_AT wrote:
EscPlan9 I urge you to not take a job at a help desk if your education enables you to work as a junior developer (at least that's what I am guessing you wanna do).


To clarify, my current position (for the past year) is at a help desk. I worked here because they were flexible with my scheduling while I completed my bachelors at university and paid decently.

For those who run into a similar situation as me - before you get into an interview about a developer position:
1) research your market value worth in the area ahead of time (there are numerous online resources)
2) keep track of your budget and bills and consider future bills that may come in (such as student loans). This will help you better grasp an absolute minimum offer to accept.
3) During the interview, do not mention a salary amount. There are various ways to word it to avoid specifying a specific amount - basically you want to tell them to agree on the job being a good fit for you first, and later on agreeing on a fair compensation for the work done.

And for those curious, after I pushed back on the offer yesterday, I was followed up with today. I learned more about the details of the all the benefits offered and we came to a mutual agreement where I am satisfied with a slightly modified offer. I am accepting the job offer and have put in my two week notice with my current company.

I am very happy to be moving forward in my career. It will be an excellent experience for me and I always have the opportunity to develop further.

Thanks for everyone's advice again! Much appreciated!

Undefeated TL Tecmo Super Bowl League Champion
RedDeckWins
Profile Joined December 2010
United States123 Posts
Last Edited: 2013-07-31 17:28:31
July 31 2013 17:26 GMT
#6651
On August 01 2013 02:12 EscPlan9 wrote:

I am very happy to be moving forward in my career. It will be an excellent experience for me and I always have the opportunity to develop further.

Thanks for everyone's advice again! Much appreciated!



Congratulations!

I have some advice for you about two years from now, and most of my colleagues agree. No matter how great you think your job is in two years, you should start looking around. Everyone I know that has left the job they had right out of college has said it was the best decision they made, and they wish they would have left earlier.

It is important to stay in one place for a few years and get a good foundation, but once you have that foundation you should see what else is out there.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2013-07-31 17:36:14
July 31 2013 17:35 GMT
#6652
While there's nothing explicitly wrong with your suggestion to look around after a few years, perhaps anecdotal evidence isn't the best way to back it up.

One piece of evidence to back up your claim is that a change in positions between companies is usually a higher pay raise than staying put or moving around within a company. Depending on the industry, this may be your best way to move forward in your career, compensation-wise.

Personally, I'm still at the place I got to right out of college. I was lucky to find a place that suited my attitude towards programming, and a job at the company where I get to do what I love doing. I wouldn't be as happy if they weren't paying a competitive salary.
Any sufficiently advanced technology is indistinguishable from magic
RedDeckWins
Profile Joined December 2010
United States123 Posts
July 31 2013 17:41 GMT
#6653
On August 01 2013 02:35 RoyGBiv_13 wrote:
While there's nothing explicitly wrong with your suggestion to look around after a few years, perhaps anecdotal evidence isn't the best way to back it up.

One piece of evidence to back up your claim is that a change in positions between companies is usually a higher pay raise than staying put or moving around within a company. Depending on the industry, this may be your best way to move forward in your career, compensation-wise.

Personally, I'm still at the place I got to right out of college. I was lucky to find a place that suited my attitude towards programming, and a job at the company where I get to do what I love doing. I wouldn't be as happy if they weren't paying a competitive salary.


What he said. Take my anecdotal evidence with a grain of salt, but in terms of getting a raise, the best way is to get another offer on the table and have your current employer match it, or take the other offer.


Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-07-31 23:04:40
July 31 2013 23:03 GMT
#6654
On July 31 2013 21:18 darklordjac wrote:
Sorry if this question has been asked and answered before in this thread (which it probably has) but I want to learn to code but not really sure on which language I should start with. Now I am not a complete noob as I have learned some basic python, which was fun and all but just didn't like how it seemed to do everything for you if that makes sense. I also completed two high school computer science classes in which we used java.

I was thinking C, thoughts? Or would I be better off with learning a higher level language first and than moving onto the "harder" stuff like C first? Or does it not matter?


I think C may improve your knowledge on programming. I'm very far from mastering the language, but C has less libraries and it also has pointers so it should be a challenge if this is what you want. Besides, C isn't object-oriented, so this should be new experience.

As I said, I'm not good at C yet, but it's good to know this language too. Java's syntax is really close to C's, so you also have a nice start.
darklordjac
Profile Joined July 2010
Canada2231 Posts
August 01 2013 01:18 GMT
#6655
Cool taking in everyone's input and asking some of my friends that are into coding (they all said C was a good idea except for one who said C++ but all my programmer friends make fun of him for being a C++ fanboy lol) I've decided to go ahead and start with C.

Now onto the next question, where do you guys suggest to start? I'm guessing a book or something since I don't wanna go for classes or anything of the sort (takes too much time + money) so can any of you recommend a book? Also if I have any questions would it be okay to ask here?
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
August 01 2013 10:39 GMT
#6656
wow, I didn't know Facebook gives out a $1000 reward if you report a logical bug
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
phar
Profile Joined August 2011
United States1080 Posts
August 01 2013 16:40 GMT
#6657
Bug bounties are a fairly common thing. Chrome for instance has a whole slew of tiered bug bounties... I think some in excess of $20k.
Who after all is today speaking about the destruction of the Armenians?
lannisport
Profile Joined February 2012
878 Posts
August 02 2013 15:23 GMT
#6658
I have a question, I want to build a fairly large scale web app (Think something like treehouse but smaller) and I was wondering if something like that is possible to do in Yii or cakePHP. My original plan was to do it in Ruby on Rails but I'm working with some pretty good developers right now and their expertise is in php frameworks. It would be a lot less costly and I could get a minimal viable product out sooner. Anyone have any recent book recommendations on scalability and web architecture as well? I know of "The Art of Scalability" and "Web Application Architecture: Principles, Protocols and Practices ".
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
August 02 2013 18:47 GMT
#6659
God I hate internet explorer. I'm sure anytime someone opens up IE somewhere in the world something terrible happens to a cute animal. If you're viewing this in IE right now, do the world a favor: punch yourself in the face for all the damage you've caused to web developers, and go download a real (read not IE) web browser.

Ok, so I recently launched a new web page that uses some css3 dynamic styling so I don't have to do that shit in photoshop anymore. Of course, knowing Internet Explorer sucks, I always made sure that the webpage would still work right in IE (even though all the cool css styling wouldn't show up). Unfortunately, I made the mistake of thinking IE could ever do anything right ever. I tested the webpage in IE 10 while making it, and used the developer tools (f12) to even check early versions of the browser (back to IE 7). It loaded correctly and worked fine whenever I checked the page in any of those versions (according to my IE).

Of course, come launch time, I get emails saying it doesn't work right in IE 9. I've temporarily just made it redirect users on IE earlier than 10 to the old webpage(as an aside, I love how Microsoft knows their browser is so shitty that they make this pseudo-code to make exceptions just for their steaming pile of shit), but I'm wondering if anyhow knows how to get the developer tools in IE actually do what they are supposed to do (show the version of IE that I've selected). Even if I set my IE browser to IE 9, it displays the webpage fine. However, if I go to a machine that is still on ACTUAL IE 9, it gets f'd up. Does anyhow know how to get this piece of crap to load at an earlier version correctly, so I don't have to physically go check it on an old machine?
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
LukeNukeEm
Profile Joined February 2012
31 Posts
August 02 2013 18:50 GMT
#6660
Im incredibly confused by this:
I have a class representing an image that lets you add colors to pixels, and it averages all of the colors on a pixel (so if I add red to a pixel, and then green, i get orange). I wanted to do some simple performance testing:
	AveragedImage<float> ai;
ai.setSize(640, 480);
ai.setPixelLayout("rgb");
auto start = std::chrono::steady_clock::now();
for (unsigned int y = 0; y < 480; y++)
{
for (unsigned int x = 0; x < 640; x++)
{
for (unsigned int i = 0; i < x; i++)
{
ai.addColor(x, y, Vec3f(255, 0, 0));
}
for (unsigned int i = x; i < 640; i++)
{
ai.addColor(x, y, Vec3f(0, 0, 255));
}
}
}
ai.foo();
auto end = std::chrono::steady_clock::now();
auto total = end - start;
std::cout << "total: " << std::chrono::duration <double, std::milli> (total).count() << " ms" << std::endl;
ai.save("rgb.bmp");
So far, so good.
Now i wanted to see how much time gets spent inside the loops, and how much time foo() takes:
	AveragedImage<float> ai;
ai.setSize(640, 480);
ai.setPixelLayout("rgb");
auto start = std::chrono::steady_clock::now();
for (unsigned int y = 0; y < 480; y++)
{
for (unsigned int x = 0; x < 640; x++)
{
for (unsigned int i = 0; i < x; i++)
{
ai.addColor(x, y, Vec3f(255, 0, 0));
}
for (unsigned int i = x; i < 640; i++)
{
ai.addColor(x, y, Vec3f(0, 0, 255));
}
}
}
auto mid = std::chrono::steady_clock::now();
ai.foo();
auto end = std::chrono::steady_clock::now();
auto loop = mid - start;
auto foo = end - mid;
auto total = end - start;
std::cout << "loop: " << std::chrono::duration <double, std::milli> (loop).count() << " ms" << std::endl;
std::cout << "foo: " << std::chrono::duration <double, std::milli> (foo).count() << " ms" << std::endl;
std::cout << "total: " << std::chrono::duration <double, std::milli> (total).count() << " ms" << std::endl;
ai.save("rgb.bmp");
Surprisingly, the total amount of time is increased by ~150ms. Is std::chrono::steady_clock::now() really that expensive?
But now comes the part that i absolutely do not understand the slightest: when i add some work after all this:
	AveragedImage<float> ai;
ai.setSize(640, 480);
ai.setPixelLayout("rgb");
auto start = std::chrono::steady_clock::now();
for (unsigned int y = 0; y < 480; y++)
{
for (unsigned int x = 0; x < 640; x++)
{
for (unsigned int i = 0; i < x; i++)
{
ai.addColor(x, y, Vec3f(255, 0, 0));
}
for (unsigned int i = x; i < 640; i++)
{
ai.addColor(x, y, Vec3f(0, 0, 255));
}
}
}
auto mid = std::chrono::steady_clock::now();
ai.foo();
auto end = std::chrono::steady_clock::now();
auto loop = mid - start;
auto foo = end - mid;
auto total = end - start;
std::cout << "loop: " << std::chrono::duration <double, std::milli> (loop).count() << " ms" << std::endl;
std::cout << "foo: " << std::chrono::duration <double, std::milli> (foo).count() << " ms" << std::endl;
std::cout << "total: " << std::chrono::duration <double, std::milli> (total).count() << " ms" << std::endl;
ai.save("rgb.bmp");
ai.setPixelLayout("bgr");
ai.save("bgr.bmp");
ai.setPixelLayout("bagr");
ai.save("bagr.bmp");
(note: the code inside the timekeeping has not changed at all), it suddenly becomes faster again. wtf?

Prev 1 331 332 333 334 335 1032 Next
Please log in or register to reply.
Live Events Refresh
WardiTV Team League
11:00
Playoffs Day 2
WardiTV753
ComeBackTV 609
Rex91
3DClanTV 58
Liquipedia
CranKy Ducklings
10:00
Sea Duckling Open #144
CranKy Ducklings80
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko363
Rex 91
StarCraft: Brood War
Britney 51379
Sea 2528
Jaedong 1422
Hyuk 421
EffOrt 401
Mini 362
Shuttle 349
firebathero 313
Light 267
Last 211
[ Show more ]
ggaemo 162
Zeus 153
hero 133
PianO 87
Pusan 67
Shine 57
Shinee 56
[sc1f]eonzerg 55
HiyA 39
Free 35
Barracks 31
Hm[arnc] 30
scan(afreeca) 30
Sacsri 19
Movie 18
yabsab 15
Sexy 13
Noble 11
GoRush 11
ajuk12(nOOB) 8
Rock 7
Icarus 2
Dota 2
Gorgc6570
XaKoH 846
XcaliburYe246
Counter-Strike
zeus408
Heroes of the Storm
Khaldor19
Other Games
singsing1938
B2W.Neo980
Hui .120
ArmadaUGS69
QueenE51
Organizations
Counter-Strike
PGL14807
Other Games
BasetradeTV978
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
CasterMuse 0
sctven
[ Show 13 non-featured ]
StarCraft 2
• CranKy Ducklings SOOP47
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1938
• TFBlade1305
Upcoming Events
uThermal 2v2 Circuit
2h 33m
IPSL
3h 33m
Hawk vs TBD
StRyKeR vs TBD
BSL
6h 33m
n0maD vs perroflaco
TerrOr vs ZZZero
MadiNho vs WolFix
DragOn vs LancerX
Sparkling Tuna Cup
21h 33m
WardiTV Team League
22h 33m
OSC
1d
BSL
1d 6h
Sterling vs Azhi_Dahaki
Napoleon vs Mazur
Jimin vs Nesh
spx vs Strudel
IPSL
1d 6h
Artosis vs TBD
Napoleon vs TBD
Replay Cast
1d 20h
Wardi Open
1d 21h
[ Show More ]
Afreeca Starleague
1d 21h
Soma vs YSC
Sharp vs sSak
Monday Night Weeklies
2 days
Afreeca Starleague
2 days
Snow vs PianO
hero vs Rain
GSL
2 days
Replay Cast
3 days
Kung Fu Cup
3 days
The PondCast
4 days
Escore
5 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

Escore Tournament S2: W2
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
RSL Revival: Season 5
WardiTV TLMC #16
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.