rainwoodman / vast

vala and scientific numerical computation
11 stars 1 forks source link

Array shall cache data.getdata() #26

Closed rainwoodman closed 7 years ago

rainwoodman commented 7 years ago

Because the data object of an Array is immutable (I am not refering to the memory stored but the memory location), there is really no need to call data.get_data() every time we need it. The Array can simply cache this pointer.

The consequence is we eliminated a bunch of functions whose pure purpose is to access data.get_data() quickly.

There are too many _ starting functions in the Array class. It does not smell good.

arteymix commented 7 years ago

These are mostly inlined, so it's somewhat okay considering that the logic is not polluting the actual function.

I agree, we have to cache that pointer! I already access _data directly (Vala produce implicit properties for that), but we need a _cached_data for faster access.

arteymix commented 7 years ago

You could change that as well in MultiIterator PR.