Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

11-12-2015 , 06:25 AM
Quote:
Originally Posted by jjshabado
Turns out Wolfram and I are programming soul mates.

Emacs or Vim?
Trying to learn vim. I've never tried emacs. But I do most of my programming on IntelliJ IDEA.

Btw, I was joking with the newline vs no newline. Either way is fine, as long as its consistent.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 08:34 AM
I know. That's why we're soul mates!

At least until I saw that you use IntelliJ instead of Eclipse.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 09:30 AM
IntelliJ is prettier
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 09:46 AM
Quote:
Originally Posted by ChrisV
I prefer no newline for opening brace, but I'm not religious about it.

No newline takes up less vertical space, which is important to me. I'm not clear on what the advantage of using a newline is supposed to be.
All your brackets line up
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 11:33 AM
Quote:
Originally Posted by Wolfram
IntelliJ is prettier
You broke my heart.

Spoiler:
Actually, I just use Eclipse because its what I've always used and I don't do *that* much Java programming these days that its worth switching.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 02:16 PM
I prefer newline. Easier to see where a block starts and ends.

MSFT code standards require new line.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 02:18 PM
Also I do not mind intro classes being nitty about style. It is a good habit to reinforce early on. It is not too hard to scan your code before you turn it in to verify it meets style requirements, you just need to remember to do it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 02:24 PM
Code:
foo          () 
             {
variables;
                // control structures here
             }
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 03:08 PM
I want to stab you
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-12-2015 , 08:34 PM
lol
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 12:40 AM
Hi friends!
quick question:

Code:
int b = somecondition;

x1 = b? 0.0f : somecalculation1;
x2 = b? 0.0f : somecalculation2;
x3 = b? 0.0f : somecalculation3;
...
x9 = b? 0.0f : somecalculation9;
Code:
if(somecondition){

x1 = somecalculation1;
x2 = somecalculation2;
x3 = somecalculation3;
...
x9 = somecalculation9;
}
else
{
x1 = 0.0f;
x2 = 0.0f;
x3 = 0.0f;
...
x9 = 0.0f;
}
why is the first implementation a lot faster than the second??
even though the condition b is checked 9 times as opposed to 1//
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 12:58 AM
Quote:
Originally Posted by CyberShark93
Hi friends!
quick question:

Code:
int b = somecondition;

x1 = b? 0.0f : somecalculation1;
x2 = b? 0.0f : somecalculation2;
x3 = b? 0.0f : somecalculation3;
...
x9 = b? 0.0f : somecalculation9;
Code:
if(somecondition){

x1 = somecalculation1;
x2 = somecalculation2;
x3 = somecalculation3;
...
x9 = somecalculation9;
}
else
{
x1 = 0.0f;
x2 = 0.0f;
x3 = 0.0f;
...
x9 = 0.0f;
}
why is the first implementation a lot faster than the second??
even though the condition b is checked 9 times as opposed to 1//
Check the generated assembly code. The compiler likely optimizes the first implementation and doesn't really check 9 times.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 02:35 AM
CPUs can stage multiple instructions in parallel (even ignoring extra cores on modern CPUs). When a conditional branch (the if check) occurs and the CPU fails to correctly branch predict, it effectively idles the entire pipeline, waiting on a single check to complete before continuing execution of the program. So it's sometimes desirable to just execute more instructions to avoid a conditional branch in order to keep everything moving along.

The ternary op version is more likely to be compiled into an optimal series of calculations and cmov ops since there are no clear data dependencies in the code. cmov doesn't require prediction, so there is much less variance in the cycles used.

In the end though, if you're writing for modern CPUs, the branch prediction is good enough that it's not worth butchering your code over a few potential cycles.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 06:22 AM
Quote:
Originally Posted by CyberShark93
Hi friends!
quick question:

Code:
int b = somecondition;

x1 = b? 0.0f : somecalculation1;
x2 = b? 0.0f : somecalculation2;
x3 = b? 0.0f : somecalculation3;
...
x9 = b? 0.0f : somecalculation9;
Code:
if(somecondition){

x1 = somecalculation1;
x2 = somecalculation2;
x3 = somecalculation3;
...
x9 = somecalculation9;
}
else
{
x1 = 0.0f;
x2 = 0.0f;
x3 = 0.0f;
...
x9 = 0.0f;
}
why is the first implementation a lot faster than the second??
even though the condition b is checked 9 times as opposed to 1//
How much faster?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 06:56 AM
Quote:
Originally Posted by KatoKrazy
Check the generated assembly code. The compiler likely optimizes the first implementation and doesn't really check 9 times.
Could be i might try this today at work.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 06:59 AM
Quote:
Originally Posted by PoppaTMan
CPUs can stage multiple instructions in parallel (even ignoring extra cores on modern CPUs). When a conditional branch (the if check) occurs and the CPU fails to correctly branch predict, it effectively idles the entire pipeline, waiting on a single check to complete before continuing execution of the program. So it's sometimes desirable to just execute more instructions to avoid a conditional branch in order to keep everything moving along.

The ternary op version is more likely to be compiled into an optimal series of calculations and cmov ops since there are no clear data dependencies in the code. cmov doesn't require prediction, so there is much less variance in the cycles used.

In the end though, if you're writing for modern CPUs, the branch prediction is good enough that it's not worth butchering your code over a few potential cycles.

Good post, we don't know much about how he actually made this determination that it is a lot faster. Cache memory misses too but I don't see a reason why that would be the case but who knows. Interesting question though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 08:36 AM
Quote:
Originally Posted by adios
How much faster?
About 1.3 times faster,
It's actually the d2q9 lattice Boltzmann problem, I replaced all the conditionals that I can with selects,
It actually depends on the input a bit, but roughly the whole algorithm ran 1.3 times faster
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 02:40 PM
Is it considered bad form when you're at a meetup and talking to some guy and he says " I have my own startup" and I say "cool how many employees and how is it funded" and he says "oh its just me and no funding and no revenue yet" and I burst out laughing?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 02:44 PM
burst out laughing, like 'lol omg how pathetic'?

or burst out laughing, like 'oh, haha, I'm sorry, didn't mean anything by it'?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 02:44 PM
Ugh, yes?

Aside from being rude, it seems like most start-ups start with 1 or 2 people and no funding.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 02:48 PM
Quote:
Originally Posted by Roonil Wazlib
burst out laughing, like 'lol omg how pathetic'?

or burst out laughing, like 'oh, haha, I'm sorry, didn't mean anything by it'?
The second one obv I'm only a dick on the Internet.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 02:53 PM
as long as it came across as laughing due to the awkwardness of the situation, i don't see an issue
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 03:45 PM
just saw this on a video about devops, made me chuckle

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 04:14 PM
I think having your own startup is not the same as working for just yourself with no revenue.

Having a startup implies some level of responsibility to me, like you at least have someone you have to pay, even as a contractor, and at least a client or two that you are trying to service.

It sounds like he is just doing nothing much of anything, I would hardly call it a startup at that point unless you are consistently putting 40+ hours a week into it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
11-13-2015 , 04:38 PM
Quote:
Originally Posted by Larry Legend
I would hardly call it a startup at that point unless you are consistently putting 40+ hours a week into it.
I don't think having people to pay or having customers is necessary. I think this to me is the measure of a startup. If you're working full time on an idea of yours with plans of growing a business around it - I have no problem with calling it a startup.

Edit: Both startups I've been closely involved with went through a phase with 2-3 people not getting paid and no customers. One did an ok-ish exit and the other is doing really well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m