2017-06-21 38 views
2

如何在Julia中預留內存(或不分配內存地址)?在C++中,常見模式是在呼叫push_back幾次之前調用reserve,以避免不止一次呼叫malloc。朱莉婭有沒有相同的東西?在Julia中預先準備好陣列內存

回答

4

我認爲你正在尋找sizehint!

help?> sizehint! 
search: sizehint! 

    sizehint!(s, n) 

    Suggest that collection s reserve capacity for at least n elements. This can 
    improve performance. 
相關問題