What are the benefits to marking a field as `readonly` in C#?

I don’t believe there are any performance gains from using a readonly field. It’s simply a check to ensure that once the object is fully constructed, that field cannot be pointed to a new value. However “readonly” is very different from other types of read-only semantics because it’s enforced at runtime by the CLR. The … Read more

Why does concatenation of DataFrames get exponentially slower?

Never call DataFrame.append or pd.concat inside a for-loop. It leads to quadratic copying. pd.concat returns a new DataFrame. Space has to be allocated for the new DataFrame, and data from the old DataFrames have to be copied into the new DataFrame. Consider the amount of copying required by this line inside the for-loop (assuming each … Read more