Ondřej Čertík
Ondřej Čertík
The canonical way is to pre-allocate the array and then append to it, like this: ```fortran integer :: i integer, allocatable :: a(:) allocate(a(100000000)) do i = 1, 1000 a(i)...
@zbeekman Generic programming will not make it to the next standard revision -- simply because there is no proposal that is ready. I think the latest most developed idea is...
Yes, the issue https://github.com/j3-fortran/fortran_proposals/issues/125 is the latest based on our discussion with Magne at the last meeting. Anyway, let's move the discussion about this there, I just wanted to point...
@LadaF nice to meet you! Small world. You should put your name and photo at your GitHub profile if you can.
I still don't understand when you would use a linked list. Deallocating 65K integers should be immediate, not take 8s. Using a 1D array would achieve that.
> For 10^6 elements, my IntegerSet container builds in 2 seconds and destroys in 0.21 seconds. If I insert the elements in order, the construction time reduces to ~1 second....
@tclune yes, so far every example where a linked list would perform well that I figured out can always be implemented using arrays/vectors more efficiently.
Yes, my point would be that you don't want to do that. If you don't know the size of the loop, then one can double the allocation and make a...
It looks like a dedicated method `push_back` (in stdlib!) might be the way to go. The compiler can then optimize it like `std::vector` works by doubling the allocation if needed.
> Not sure about "compiler can optimize". The algorithm is baked into the implementation of STL vectors. The vector interface does not really give the compiler any hint of how...