08-08-2013, 02:05 PM
mozi Wrote:performance analysis
The problem here is not the recording but the listing itself.
Let's say you use the current text based admin logs;
- you extract the minutes and XYZ from the text - this is O(1) in this scope, but extracting an (assumingly well-formatted) value from the string is O(len), not to mention you have to do three string to integer casts
- now, you do a range check for each camera - the range check itself can be done manhattan style in O(1), so this is O(camera count)
- for each camera that passes this test, you have to check if the camera was active at the time, depending on storage this is O(1) or O(minutes elapsed); on any hits, abort, we saw this action.
Doesn't sound too bad, right? There are a few expensive operations in there, list management, string manipulation, etc. For each log entry.
We have two relatively infeasible options - either you do this, use the admin logs, and have a possibly massive server lockup each time someone click the FILTER button on the computer, or otherwise write a logging for this system which stores the data in a way that is easier to access - ie. it's well indexed. The latter will place additional load on action processing, but a well indexed dataset is fast to access. This is not as trivial as you might think.