-
Notifications
You must be signed in to change notification settings - Fork 104
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
optimize file listing #507
Conversation
Give an example to test it. Command being timed: "./help-test"
real 0m2.075s
user 0m0.000s
sys 0m0.047s Example2: fpm(brocolis branch Command being timed: "fpm test help-list"
real 0m2.851s
user 0m0.015s
sys 0m0.000s Example3: fpm(0.3.0 release Command being timed: "fpm test help-list"
real 0m7.762s
user 0m0.015s
sys 0m0.031s
I'm sorry, I used |
No worries @zoziha and thanks for checking it again - glad to see that it's an improvement (great work @brocolis!).
Yes this is true. We could solve it by wrapping the relevant code in a |
Hi @zoziha, @LKedward, thanks for the feedback!. Yes, the |
As long as we have a single-file Fortran version that can be used in a two step bootstrapping process we would be fine. But I agree that retaining the single-file option for an one step bootstrapping process has some value. |
Thanks @awvwgk, I'll try a version with a tiny C wrapper. |
Thanks @brocolis - I think this is the right way to go since there are other file system functions that will need rewriting in a similar manner. Perhaps you can use preprocessor directives to enable the existing non c implementation just for when we produce the single-file version as Sebastian mentioned. |
Added |
Great stuff @brocolis! However I think we should use the |
How about using |
CI Build (macos-latest) failed with
I don't have access to macOS machine, can't run it under debugger.. need help here. |
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.
I think we can find a more meaningful file name than c.c
for the file system functionality.
I agree. Do you have any suggestion? |
I tried renaming the |
@everythingfunctional do you have a Mac machine and can possibly help out here? |
@LKedward , I may have some time later today or tomorrow to give it a try. Are there any special instructions for how I should start? Or just build this branch and run the test suite? |
Thanks! The error appears to be in |
Ok, running the command
In my experience gdb on Mac is very flaky, hence why it doesn't seem to have been able to provide a full backtrace and I wasn't really able to inspect the state of things much. This gives you a place to start looking, but not a lot to go on. If there are other things you'd like me to try I can, just let me know. |
Thanks @everythingfunctional ! I will look into the issue. |
I have no experience with MacOS but perhaps the Intel Inspector tool from
Intel oneAPI can help? I have found it to be quite useful on Windows for
memory-related issues.
Op di 13 jul. 2021 om 06:03 schreef Carlos Une ***@***.***>:
… Thanks @everythingfunctional <https://github.com/everythingfunctional> !
I will look into the issue.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#507 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN6YRZYQWCBB5MTCJB22LTTXO3JRANCNFSM47RL4OBA>
.
|
Hi Carlos @brocolis - I've implemented a small fix for OSX based on this conversation: rust-lang/libc#414. |
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.
I would call it filesystem_utilities.c
, but the rest looks ok. I like that we are able to switch back to a pure Fortran implementation for producing a single file "bootstrap" version.
@LKedward looks good. Thank you for the fix!. |
@everythingfunctional thank you for the suggestion!. I'll rename it. |
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.
Great stuff Carlos @brocolis! With a few more reviews I think this is good to go 👍
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.
LGTM Great work guys
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.
Thanks a lot, this will be a significant improvement.
Carlos @brocolis, are you able to resolve the merge conflicts in this, or do you need help? |
@LKedward I'm not able to resolve the merge conflicts, I need help. 'Resolve conflicts' button appears disabled for me. |
No problem @brocolis - I can take a look at it. |
Many thanks Carlos @brocolis and thanks everyone for reviewing! With three approvals, I'll now merge. |
This PR is an attempt to optimize the file listing subroutine as reported at Discourse [1].
This implementation is pure Fortran using the iso_c_binding module, but it depends on the preprocessor to compile. The trouble is that the C types
struct dirent
andstruct stat
have different sizes/contents in different platforms. [2-5]This PR was tested on Windows with MinGW 32 bit and MinGW 64 bit. On linux, it was tested with Debian 32 bit and Debian 64 bit. In all other platforms, this PR has no effect.
To enable this feature, build
fpm
withCC @zoziha, @LKedward
[1] https://fortran-lang.discourse.group/t/fpm-may-be-io-blocking-problem-feedback-in-fpm-test
[2] https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/crt/dirent.h
[3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
[4] https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/crt/sys/stat.h
[5] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html