Skip to content
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

Contact duration and distance #123

Merged
merged 25 commits into from
Jul 22, 2020
Merged

Contact duration and distance #123

merged 25 commits into from
Jul 22, 2020

Conversation

ivnsch
Copy link
Collaborator

@ivnsch ivnsch commented Jul 10, 2020

No description provided.

@ivnsch ivnsch force-pushed the feature/duration-distance branch from c5b14b7 to 040155e Compare July 10, 2020 16:19
@duskoo
Copy link
Collaborator

duskoo commented Jul 15, 2020

@i-schuetz Ups, I noticed its a draft PR only after I have gone through the whole thing :(
Looks good by the way 👍

src/reports_updater.rs Outdated Show resolved Hide resolved
@Co-Epi Co-Epi deleted a comment from duskoo Jul 16, 2020
@Co-Epi Co-Epi deleted a comment from duskoo Jul 16, 2020
@ivnsch ivnsch force-pushed the feature/duration-distance branch from 59b336c to 6638b99 Compare July 16, 2020 16:26
@ivnsch ivnsch force-pushed the feature/duration-distance branch from 6638b99 to 18e5f6b Compare July 16, 2020 16:54
@ivnsch ivnsch force-pushed the feature/duration-distance branch from 18e5f6b to 076a86b Compare July 16, 2020 16:56
@ivnsch ivnsch force-pushed the feature/duration-distance branch from 1ed3f93 to 2e2077a Compare July 16, 2020 19:41
@ivnsch ivnsch marked this pull request as ready for review July 16, 2020 20:40
@ivnsch ivnsch requested a review from duskoo July 16, 2020 20:40
@ivnsch ivnsch force-pushed the feature/duration-distance branch from 2275ba7 to a8049aa Compare July 16, 2020 20:56
@ivnsch ivnsch marked this pull request as draft July 17, 2020 08:43
@ivnsch ivnsch requested a review from duskoo July 17, 2020 12:22
@ivnsch ivnsch marked this pull request as ready for review July 17, 2020 12:22
@ivnsch ivnsch force-pushed the feature/duration-distance branch from 3b39c97 to 6f72b45 Compare July 17, 2020 12:23
@ivnsch ivnsch force-pushed the feature/duration-distance branch from cb13cb7 to 3ff6f0a Compare July 17, 2020 16:09
src/reports_updater.rs Outdated Show resolved Hide resolved
src/reports_updater.rs Outdated Show resolved Hide resolved
src/reports_updater.rs Outdated Show resolved Hide resolved
Some(merged ) => vec![merged],
None => vec![last.to_owned(), tcn]
};
let mut head: Vec<ObservedTcn> = db_tcns.to_owned().into_iter().take(db_tcns.len() - 1).collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could avoid iterating over the vector and just replace the last element: https://doc.rust-lang.org/std/mem/fn.replace.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear how mem::replace helps. It seems to replace the complete vector. db_tcns is also unlikely to contain more than a couple of elements (these are the stored, averaged exposures for an individual TCN) so the performance is negligible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mem::replace works on a vector element.
Good point regarding small vector size.

@ivnsch ivnsch merged commit 9bb43af into master Jul 22, 2020
@ivnsch ivnsch deleted the feature/duration-distance branch July 22, 2020 13:14
@ivnsch ivnsch linked an issue Jul 23, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distance and duration handling
2 participants