-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Temporary prop as dynamicprop #41
Conversation
Ardupilog.m
Outdated
@@ -132,6 +133,9 @@ function delete(obj) | |||
continue; | |||
end | |||
|
|||
msgLen = obj.fmt_cell{i,3}; | |||
data = obj.isolateMsgData(msgId,msgLen,allHeaderCandidates); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this went before the filter?
If it goes before, then it will be run regardless of whether this message should be filtered out or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see that you need to fill the valid_msgheader_cell. Okay.
Would it be possible to avoid that, to avoid unnecessary cycles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think you do that for all the messages, so as to have all the locations of the valid message headers. Understandable, but it will cause a major hit in efficiency. Effectively, it will be the same as parsing ALL the headers.
We should evaluate if this delay is unacceptable or not.
Ardupilog.m
Outdated
% Write to the LogMsgGroup | ||
obj.(msgName).setLineNo(msg_LineNo); | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what you do here is: (correct me if I'm wrong)
- You sort the locations of all messages
- For each filtered message you search the line numbers of the corresponding messages and store them in the LineNo property
I'm a bit concerned with the fact that this change makes the program search for all the messages, regardless of filter. This removes any time savings filtering brought. Granted, I don't see any other way to do it, if we need the line numbers. Are we ok with doing away with those time savings? Indicatively, the 150MB file would parse in my PC in 20 secs and proportionally less for any kind of filtering. |
Is this done in favour of simplicity or size reduction? |
I agree there's a design-choice to be made here, with pros-and-cons for any choice. With the log parsing speed so fast, I propose the following general design:
At this intermediate point, we have everything we need: the position of all valid messages in the log. We could also check for any regions of the log which are NOT part of a valid message, as well as any overlap. (if that's even possible) We also have a count of the total number of log lines, the number of lines of each type, etc.
A con of this design is that we spend time finding (and counting) messages that we intend to filter, and could have skipped. Note that we still don't spend time processing-and-storing those messages, so the filter is still valuable for increasing speed. I hope the pros of this design outweigh the cons. Here are a few pros I see: having true LineNo info, having a count of the total log messages, having the ability to see if the log has lots of undefined/invalid messages (not presently implemented) What do you think? |
I run a profiler on the 150MB log on your latest version. In both cases we might be able to pull one or two tricks to make it faster. |
Can you also address my question regarding the need for creating and deleting dynamic props? |
…es, and delete them at the end of log processing. Also removed some old, unused properties
5dcc512
to
aa4eea9
Compare
Rebased and force-pushed the last 2 PRs, after merging LineNos |
With respect to changing temporary properties to become dynamic properties: |
With regards to my proposed design above: |
I think this adds a lot of code complexity which isn't good when we'll be going through the code a month later, looking for a property which isn't at the start of the file. In other words, it hurts readability. Besides, as you said the reduction is space is probably not an issue. I actually would prefer that this wouldn't go in. Do you have a serious problem with that? |
Okay, no problem, that's fine with me. We will keep them as private properties. Do we still want to overwrite them with trivial values at the end of log-loading? And this is a new Github experience for me. Do we close the pull request without merging, and also delete the branch? If so, it's probably easiest to delete the dependent PR #42 and re-code that one as a new pull-request according to the discussion over there. |
(Let's keep the overwrites, I think it's a free space bonus)
|
Excellent. In this case I'm going to opt for the "manual" option over the rebase. I'll close the PR and delete the branch. |
[NOTE]
This PR is dependent on #33 . If we make changes to that, we can rebase this one as you specified in an email on March 2nd.
[Description]
Some properties of the Ardupilog class were temporary. We used them as "global within the class", but didn't intend to store their info. I've made them each into a DynamicProperty, so that we can delete them at the end.
In the future, if we re-organize the methods, they might become local variables to a single method.
I also deleted a few properties that don't seem to be used anymore.