[IMPROVEMENT] Thoughts on DDI Data Loader #22
Labels
enhancement
New feature or request
help wanted
Extra attention is needed
question
Further information is requested
Hey @00krishna,
These are my thoughts on your recent implementation for #21! As I mentioned over Slack, the functionality is sufficient enough that I went ahead and merged the PR, but as we discussed, there does seem to be some places for improvements. I am going to copy some of our discussion to here first so as to not lose thoughts as well as add in my own thoughts and comments along the way.
Basic Benchmarking
For a dataset with about 70 million elements, I see this time and allocation count:
For a dataset with only 60,000 elements, I see this time and allocation count:
Interestingly, when I tried using
ipumsr
to do this, the loading for both files was nearly instantaneous. I did some digging and found that hipread seems to be doing a lot of the heavy-lifting withinipumsr
to do the parsing of this file.Thoughts on Slowdowns
Per Krishna:
After doing some further analysis using Profile.jl and PProf.jl, I was able to find the following flamegraph profiling on allocations in the code:
Although the image is not so great, one can see that a majority of the allocations occurs in the map function call as you were imagining, Krishna. Here's the code I ran to generate this flamegraph:
I attached the allocation profile file here as well.
alloc-profile.pb.gz
I also did a quick analysis of the computation. It would appear that much of the time the function is running, it is trying its best at type inference. This flame graph is a bit inscrutable but I figured I would include it here as well:
Concluding Thoughts
In short, it seems like there is a huge opportunity to optimize the loading functionality to make it more straightforwardly take advantage of the fixed width files. Although, I am not entirely sure how to do that yet. I'd be curious your thoughts @00krishna.
Otherwise, great stuff!
The text was updated successfully, but these errors were encountered: