[m-rev.] for review and benchmarking: speed up file name creation in write_deps_file.m
Peter Wang
novalazy at gmail.com
Thu Sep 7 15:40:58 AEST 2023
On Thu, 07 Sep 2023 15:23:20 +1000 Julien Fischer <jfischer at opturion.com> wrote:
>
> On Thu, 7 Sep 2023, Peter Wang wrote:
>
> >> Julien, can you please have a look at the comment on
> >> dir.relative_path_name_from_components? It implies
> >> that the predicate allows the construction of pathnames such as
> >> a/b/c/d from ["a", "b", "c", "d"], but does NOT allow
> >> the construction of the same pathname from ["a/b/c", "d"],
> >> even though the code does the right thing anyway.
> >> The relationship of that code, which merely adds
> >> the dir separator char between the components,
> >> and the / predicate, which does a lot more,
> >> should also be better documented.
> >
> > I introduced relative_path_name_from_components specifically to be fast
> > when you KNOW the list elements are simple directory components, and you
> > only want a relative path name. Directory separators, drive letters, ., ..,
> > and any other stuff that dir./ tries to deal with are out of scope as it
> > would slow down relative_path_name_from_components for the case that is
> > it designed for. We can make that clearer in the documentation as you
> > say.
>
> I aslo suggest renaming it to: unsafe_relative_path_from_components.
> (And maybe adding a safe version that does check the components.)
"Unsafe" is pushing it, isn't it? Maybe "unchecked", if you insist.
Peter
More information about the reviews
mailing list