• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 08:08
CEST 14:08
KST 21:08
  • 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
Serral wins HomeStory Cup 298Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Weekly Cups (July 6 - 12): Protoss strike back2BSL Season 22 Full Overview & Conclusion7BSL Season 22 Full Overview & Conclusion7Weekly Cups (June 29-July 5): Solar Doubles0MC vs IdrA, Boxer vs Nal_rA to be Legacy Matches @ BlizzCon44
StarCraft 2
General
Weekly Cups (July 6 - 12): Protoss strike back Is the larve respawn broken? Serral wins HomeStory Cup 29 Serral wins Maestros of the Game 2 Reynor: GSL Loss Wasn't About Preparation Format
Tourneys
GSL CK #5 Race War WardiTV Summer Cup 2026 RSL Revival: Season 6 - Qualifiers and Main Event HomeStory Cup 29 Vespene Cup #1 — $300+ USD, July 10
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together Mutation # 532 Nuclear Family
Brood War
General
screpdb: new Starcraft reporting tool Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) ASL 22 Proposed Map Pool ASL22 General Discussion BSL Season 22 Full Overview & Conclusion
Tourneys
[ASL22] Wildcard Qualifier IPSL Spring 2026 Top 4! [Megathread] Daily Proleagues CSLAN 4 is Coming!
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Path of Exile Summer Games Done Quick 2026! Nintendo Switch Thread
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread TL Mafia Power Rank Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread UK Politics Mega-thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books Movie Discussion! Anime Discussion Thread Series you have seen recently...
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Tennis[sport] Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
The Automated Ban List
Blogs
Major Shifts in the Gaming I…
TrAiDoS
An Exploration of th…
waywardstrategy
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3585 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 Weekly
11:00
WardiTV Mondays #95
IntoTheiNu 797
WardiTV687
TKL 259
Rex127
CranKy Ducklings29
CranKy Ducklings SOOP5
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko448
TKL 259
Ryung 202
Rex 127
SHIN 101
herO (SOOP) 94
DenverSC2 28
StarCraft: Brood War
Calm 6825
Sea 2219
Bisu 1645
Shuttle 1143
Jaedong 649
Hyuk 464
firebathero 418
Mini 387
BeSt 282
EffOrt 226
[ Show more ]
Light 192
Stork 168
Soulkey 167
Snow 164
ggaemo 142
Larva 142
Soma 135
Mong 83
ZerO 82
sorry 75
Pusan 64
Free 59
ToSsGirL 59
Sea.KH 53
Sharp 53
PianO 51
[sc1f]eonzerg 43
Rush 42
910 39
scan(afreeca) 30
soO 30
hero 29
JYJ 28
Bale 22
Hm[arnc] 21
Killer 21
Sexy 21
yabsab 21
Icarus 19
Aegong 17
Shine 17
sSak 16
IntoTheRainbow 16
Noble 14
Movie 11
Yoon 10
Barracks 8
Dota 2
Gorgc5340
Dendi440
syndereN110
League of Legends
JimRising 378
Counter-Strike
x6flipin228
markeloff77
Other Games
B2W.Neo693
singsing617
crisheroes257
hiko21
RuFF_SC216
ZerO(Twitch)10
Organizations
Other Games
gamesdonequick2846
BasetradeTV276
StarCraft: Brood War
lovetv 11
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• TFBlade649
• HappyZerGling99
Upcoming Events
The PondCast
21h 52m
Replay Cast
1d 20h
CrankTV Team League
1d 22h
Replay Cast
2 days
CrankTV Team League
2 days
Replay Cast
3 days
RSL Revival
3 days
Clem vs Lambo
Scarlett vs Cure
CranKy Ducklings
3 days
IPSL
4 days
Dragon vs Hawk
RSL Revival
4 days
Classic vs Trap
herO vs SHIN
[ Show More ]
Sparkling Tuna Cup
4 days
IPSL
5 days
Bonyth vs Ret
WardiTV Weekly
5 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

YSL S3
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
CSL 2026 Summer (S21)
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
XSE Pro League 2026
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

Upcoming

Escore Tournament S3: W3
ASL S22 SEASON OPEN Day 1
Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Logitech G Connect 2026
StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
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.