-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify code and improve performance
This commit simplifies and removes redundant and unnecessary code from `introvert.rb`. Some methods have been removed entirely, and others have been changed so they're used more simply (we now call `set_n_activities!` only while reading the file, instead of as-needed, which adds negligible overhead for some commands but simplifies the calling and reduces error). This change also adds an optimization: in deserializing Activities we now call `Time.parse` if possible, removing the need for slower `Chronic.parse` calls when reading the file (`Chronic` uses `Time.parse` under the hood in these cases anyway). This reduced the runtime of `friends list activities` with ~500 activities (and ~200 friends) from ~2.4 seconds down to ~0.7 seconds. (This optimization resolves #143.) Lastly, this commit adds a slight change in behavior: when commands match friend or location names, they now use those classes' regex methods for matching rather than matching any substring (so a `--with John` command will match a "John Deere" as before, but will a `--with oh` will no longer match "John Deere").
- Loading branch information
1 parent
aca85c1
commit d53599b
Showing
4 changed files
with
65 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters