-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Speed up initialization #143
Comments
Some profiling revealed that a lot of time was being spent on For ~500 activities, this reduces the time of As a note for future optimizations, it seems that processing unnecessary file data is not a significant source of slowdown, as commenting out all file reading and all |
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").
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").
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").
It would be nice if we could make
friends
perform better, as there is a noticeable lag when thefriends.md
file is large.The text was updated successfully, but these errors were encountered: