Mouse-Imaging-Centre / pydpiper

Python code for flexible pipeline control
Other
24 stars 10 forks source link

Pydpiper should use pathlib's Path class to store all filepaths #444

Open nzxwang opened 4 years ago

nzxwang commented 4 years ago

Inspired by issue #443. filepaths should not be stored as strings and python>=3.4 has a builtin pathlib library for this. It also doesn't take all that much space

>>> sys.getsizeof("/hpf/largeprojects/MICe/lqiu/collaborator_40um/Picketts/Snf2H-Snf2L/symlink_distcorr_files//Snf2Hcko-emxcre_KO1.mnc")
164
>>> sys.getsizeof(Path("/hpf/largeprojects/MICe/lqiu/collaborator_40um/Picketts/Snf2H-Snf2L/symlink_distcorr_files//Snf2Hcko-emxcre_KO1.mnc"))
112
>>> sys.getsizeof("Snf2Hcko-emxcre_KO1.mnc")
72
>>> sys.getsizeof(Path("Snf2Hcko-emxcre_KO1.mnc"))
112
bcdarwin commented 4 years ago

I could be wrong, but at a glance it looks to me like it takes 112 extra bytes per string 🙂


From: Nick Wang notifications@github.com Sent: October 29, 2019 12:52 PM To: Mouse-Imaging-Centre/pydpiper pydpiper@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Mouse-Imaging-Centre/pydpiper] Pydpiper should use pathlib's Path class to store all filepaths (#444)

filepaths should not be stored as strings and python>=3.4 has a builtin pathlib library for this. It also doesn't take all that much space

sys.getsizeof("/hpf/largeprojects/MICe/lqiu/collaborator_40um/Picketts/Snf2H-Snf2L/symlink_distcorr_files//Snf2Hcko-emxcre_KO1.mnc") 164 sys.getsizeof(Path("/hpf/largeprojects/MICe/lqiu/collaborator_40um/Picketts/Snf2H-Snf2L/symlink_distcorr_files//Snf2Hcko-emxcre_KO1.mnc")) 112 sys.getsizeof("Snf2Hcko-emxcre_KO1.mnc") 72 sys.getsizeof(Path("Snf2Hcko-emxcre_KO1.mnc")) 112

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Mouse-2DImaging-2DCentre_pydpiper_issues_444-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAABICNHYGGMFFXG3JNS3BZDQRBS33A5CNFSM4JGMEYTKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HVEDEQA&d=DwMCaQ&c=Sj806OTFwmuG2UO1EEDr-2uZRzm2EPz39TfVBG2Km-o&r=WbPKw40NU3g_RTKn7pWL3cSAdk6QRKr3kMreWPZzNcg&m=GgC_9yrpFvVyXvU_-3jfJEwjelYww5gvHHFSIqV58JE&s=Tqy3Gkdo7Am7IUdGR_YLa5uRShprkTs_bk2z27INmgE&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AABICNDKRRGGTSYMNLHH4QLQRBS33ANCNFSM4JGMEYTA&d=DwMCaQ&c=Sj806OTFwmuG2UO1EEDr-2uZRzm2EPz39TfVBG2Km-o&r=WbPKw40NU3g_RTKn7pWL3cSAdk6QRKr3kMreWPZzNcg&m=GgC_9yrpFvVyXvU_-3jfJEwjelYww5gvHHFSIqV58JE&s=XK9kEl07m98NaqszMFc95Bifaeq6ZZgx_woheUnxl7w&e=.


This e-mail may contain confidential, personal and/or health information(information which may be subject to legal restrictions on use, retention and/or disclosure) for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.