-
Notifications
You must be signed in to change notification settings - Fork 62
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
Implement Heapsize calculations #31
Conversation
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.
Nice stuff - thanks for the contribution!
I'd probably like to see this tested on Travis in a build matrix. An example of this can be seen with Moniker's .travis.yml
. Note that I had to do an ugly workaround of this bug in Cargo rust-lang/cargo#4942 to get it to work though, as setting features in workspaces is pretty broken at the moment. 🤦♂️
codespan/src/filemap.rs
Outdated
@@ -4,6 +4,7 @@ use std::borrow::Cow; | |||
use std::path::{Path, PathBuf}; | |||
use std::{fmt, io}; | |||
|
|||
use heapsize::{self, HeapSizeOf}; |
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.
This should probably be cfg-ed out with a feature flag!
codespan/src/filemap.rs
Outdated
@@ -59,6 +60,27 @@ impl fmt::Display for FileName { | |||
} | |||
} | |||
|
|||
impl HeapSizeOf for FileName { |
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.
This too!
Thanks for pointing out the missing |
.travis.yml
Outdated
- nightly | ||
- stable | ||
- beta | ||
- nightly |
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.
Nit: could we use consistent indentation here (sorry 😅 )
Looks good! I'm about to head to bed, but would you like me to merge and release tomorrow morning? Also, we have a gitter room if you'd like to chat with us in a more real time setting too. Curious to know what you plan to do with codespan! :) |
I'm currently importing directly from my I've used |
This is now released on crates.io! |
I often like having the ability to track how much memory my compiler/parser is using. This PR implements
HeapSizeOf
from the heapsize crate for various data types incodespan
, hidden behind an off-by-default feature flag.