问题描述
有人知道带有ext4文件系统的python中os.path.exists函数的复杂性吗?
Does anyone know what the complexity of the os.path.exists function is in python with a ext4 filesystem?
推荐答案
Ext4 (和 Ext3 )使用的基本目录结构与中的完全相同Ext2 . Ext3 添加日记, Ext4 改进日记.日记与您的问题无关.
Underlying directory structure used by Ext4 (and Ext3) is exactly the same as in Ext2. Ext3 adds journaling, Ext4 improves that journaling. Journaling is irrelevant to your question.
最初,Ext2曾将其存储为列表,但对于大型目录而言,效率当然较低.因此,它已更改为B树的调整版本,称为 HTree .与标准B树不同,HTree具有恒定的深度并在每个节点上使用哈希映射,因此其查找复杂度为 O(1).
Originally Ext2 used to store that as list, but that of course was inefficient for large directories. So it's has been changed to tweaked version of B-tree called HTree. Unlike standard B-tree, HTree has constant depth and uses hash-map per node, thus it's lookup complexity is O(1).
请参阅: http://ext2.sourceforge.net/2005- ols/paper-html/node3.html
这篇关于python:ext4文件系统存在os.path.exists的复杂性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!