-
Notifications
You must be signed in to change notification settings - Fork 3
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
ENH: memory usage profiling #80
Conversation
Thanks @tcpan ! I started a test run of this on my Mac with the
It would be nice to have units for
Do you know why the memory profiler seems to be interfering with the read time test? |
I can replicate this and I think it has to do with the number of times I call memory_profile function, and possibly the package's internal function calls. I will look for an alternative solution. |
I am creating a new pull request on this topic. |
Actually, I am reusing this pull request. The new benchmark uses both memory_profiler, tracemalloc, as well as resource usage package (part of PerformanceCounter class already). Memory_profiler uses psutils internally, it is used at a coarse level (e.g. 50x50s). The overhead is not zero but should be a lot lower. The results looks like this: This was tested with the numpy package on my 8th gen intel laptop cpu. One thing that is interesting when compared to other format is how low the memory usage is. My theory is that its use of memmap is helping. However, its memory usage may go up with deep copy. |
@tcpan thanks for this update! This is running much faster now. However, it does still slow down the read test times some. I think we discussed making it optional to run the memory profiler. If you agree, I think we should do that. |
I've made memory profiling optional. I have also move the walltime measurement into PerformanceCounter class. Walltime is higher than cpu time as it can include io and other system waits. |
@tcpan thanks for the updates! I see that you also do the memory profiling for the waveform write now. It takes significantly longer to write the waveform when the profiler is enabled. Did you expect this? Also, since this seems to be getting close to being merged it'd be good to add a section about how this works to https://github.com/chorus-ai/chorus_waveform/blob/main/BENCHMARK.md . |
memory profiling for write was there before. It is expected that write will take longer - the python memory_profiler package is polling during the execution. The PerformanceCounter class is lighter weight, but can only get the max memory usage and not the memory usage during the call. hence memory_profiler is still being used. I updated the BENCHMARK.md file. |
Thanks @tcpan ! |
added memory usage profiling for file write and reads. The read test memory usages are measured per function call and reported as min/mean/max.
Also reporting average wall time for the read function calls. Comparing this to the "sec" times can indicate potential presence of multithreaded code.