Are you timing the first execution of the function? Because if so it's probably reading in and compiling the DataFrames piece. What happens when you run it for a second time?
On Friday, April 3, 2015 at 8:43:12 AM UTC-7, Andre Bieler wrote: > > I have the following (for me) unexpected behavior for an if statement in > the code below: > It is not the same If I comment out the line > data = readdlm("somefile.dat") > or not. even if the "if-statement" is evaluated as false. > > The function takes much longer to execute when the line is not commented > out, with the if-statement > evaluated as false. Is it that the function readdlm still imported from > DataFrames, even though > that part of the code is never executed? > (I do get the expected print message of "dont do additional stuff" of > course...) > > thanks > andre > > using DataFrames > > function foo() > doAdditionalStuff = 0 > if (doAdditionalStuff) == 1 > println("do additional stuff") > data = readdlm("somefile.dat") > else > println("dont do additional stuff") > end > > # do regular stuff > > end > >