I understand that if you write type stable code in Julia then it’s easier to optimize and hence will result in fast running code.
But I am thinking about this in the DataFrames context, say I have a function that takes as argument a dataframe and output a dataframe always. Now the output is type-stable since it’s alway outputing a dataframe. But I can output datarames with different columns each time. That should be type-unstable right?
I am a little confused here, does it mean that by design Julia can’t optimize code that outputs Dataframes because to do that it need to know the type of each column, but the type information is not encoded into the definition of a dataframe, hence even if a function is type-stable in that it produces a dataframe always, it will still be slow as the columns’s type may change from run to run depending on inputs?