get_file_info 使用 read_until(b'\n') 手动计数;无尾换行的最后一行可能与 count_existing_lines 的 reader.lines().count() 行为不一致。
get_file_info
read_until(b'\n')
count_existing_lines
reader.lines().count()
同一文件在不同函数中得到不同 line_count,会影响 avg_line_length 和 benchmark 文件信息。
line_count
avg_line_length
crates/bench/src/data_gen.rs:25
crates/bench/src/data_gen.rs:117
统一行计数实现,例如都使用 reader.lines().count(),或显式处理最后一段无换行内容。
经审核,原 issue 描述的不一致实际不存在:read_until(b'\n') 和 lines().count() 对无尾换行文件的行为一致,均会计入最后一行。
但为减少重复代码和维护风险,已将 get_file_info 中的手动 read_until 循环替换为复用已有的 count_existing_lines(),统一行计数实现。
commit: 5656b26
5656b26
No dependencies set.
The note is not visible to the blocked user.
问题
get_file_info使用read_until(b'\n')手动计数;无尾换行的最后一行可能与count_existing_lines的reader.lines().count()行为不一致。影响
同一文件在不同函数中得到不同
line_count,会影响avg_line_length和 benchmark 文件信息。位置
crates/bench/src/data_gen.rs:25crates/bench/src/data_gen.rs:117建议
统一行计数实现,例如都使用
reader.lines().count(),或显式处理最后一段无换行内容。经审核,原 issue 描述的不一致实际不存在:read_until(b'\n') 和 lines().count() 对无尾换行文件的行为一致,均会计入最后一行。
但为减少重复代码和维护风险,已将 get_file_info 中的手动 read_until 循环替换为复用已有的 count_existing_lines(),统一行计数实现。
commit:
5656b26