[Kst] branches/work/kst/portto4/kst/src/libkst
Barth Netterfield
netterfield at astro.utoronto.ca
Wed Apr 25 22:06:27 UTC 2012
SVN commit 1291801 by netterfield:
BUG:
data vectors were reloading the entire file each time they got new data,
rather than shifting them. And shifting didn't use memmove.
These changes should speed up real time significantly.
M +3 -7 datavector.cpp
--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1291800:1291801
@@ -464,14 +464,11 @@
} else {
shift = SPF*(new_f0 - F0);
NF -= (new_f0 - F0);
- _numSamples = (NF-1)*SPF+1;
+ _numSamples = (NF-1)*SPF;
}
- // FIXME: use memmove()
- for (i = 0; i < _numSamples; i++) {
- _v[i] = _v[i+shift];
+ memmove(_v, _v+shift, _numSamples*sizeof(double));
}
- }
if (DoSkip) {
// reallocate V if necessary
@@ -559,8 +556,8 @@
int safe_nf = (new_nf>0 ? new_nf : 0);
assert(new_f0 + NF >= 0);
- if (new_f0 + safe_nf - 1 >= 0) {
//assert(new_f0 + safe_nf - 1 >= 0);
+ if (new_f0 + safe_nf - 1 >= 0) {
n_read = readField(_v+NF*SPF, _field, new_f0 + NF, safe_nf - NF - 1);
n_read += readField(_v+(safe_nf-1)*SPF, _field, new_f0 + safe_nf - 1, -1);
}
@@ -571,7 +568,6 @@
}
}
}
-
NumNew = _size - _numSamples;
NF = new_nf;
F0 = new_f0;
More information about the Kst
mailing list