• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 23:09
CET 05:09
KST 13:09
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
StarCraft Evolution League (SC Evo Biweekly) RSL Offline Finals Info - Dec 13 and 14! RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
ZeroSpace Megathread Stormgate/Frost Giant Megathread Nintendo Switch Thread The Perfect Game Path of Exile
Dota 2
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 Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1558 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
Replay Cast
00:00
WardiTV Mondays #62
CranKy Ducklings130
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 185
Nathanias 154
trigger 9
StarCraft: Brood War
Tasteless 103
Shine 86
Bale 57
NaDa 27
Icarus 7
Dota 2
monkeys_forever842
NeuroSwarm141
League of Legends
JimRising 651
Counter-Strike
Coldzera 1376
Fnx 297
Other Games
summit1g13284
tarik_tv4906
shahzam600
C9.Mang0303
WinterStarcraft211
ViBE177
Mew2King97
Organizations
Other Games
gamesdonequick979
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Hupsaiya 116
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• RayReign 20
• Azhi_Dahaki3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift3930
Upcoming Events
The PondCast
5h 51m
OSC
11h 51m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
19h 51m
Korean StarCraft League
1d 22h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.