summaryrefslogtreecommitdiffstats
path: root/core/vector.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-06-29 00:29:49 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-06-29 00:29:49 -0300
commit95047562d743b1c1fdc007432c8a0c145a455c5d (patch)
treef563e5c900c4330fcc602b6e5a721bc63022b253 /core/vector.h
parent2b64f73b0459190d20b2f6de39275ee7979317c4 (diff)
downloadredot-engine-95047562d743b1c1fdc007432c8a0c145a455c5d.tar.gz
Several performance improvements, mainly in loading and instancing scenes and resources.
A general speedup should be apparent, with even more peformance increase when compiling optimized. WARNING: Tested and it seems to work, but if something breaks, please report.
Diffstat (limited to 'core/vector.h')
-rw-r--r--core/vector.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/vector.h b/core/vector.h
index b93d9a0dea..d103400622 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -340,12 +340,14 @@ template<class T>
void Vector<T>::remove(int p_index) {
ERR_FAIL_INDEX(p_index, size());
- for (int i=p_index; i<size()-1; i++) {
+ T*p=ptr();
+ int len=size();
+ for (int i=p_index; i<len-1; i++) {
- set(i, get(i+1));
+ p[i]=p[i+1];
};
- resize(size()-1);
+ resize(len-1);
};
template<class T>