Skip to content

Conversation

@mateoatr
Copy link
Contributor

@mateoatr mateoatr commented Apr 3, 2021

In an effort to improve startup time, this PR gets rid of three different file-accessing calls inside the host:

if (pal::file_exists(additional_deps_path))

Which performs a file existence check on each of the assets inside a deps.json.

And:

pal::realpath(&real_asset_path);

Which purpose is to unroll the symbolic link of a given path and, in the later case, to later normalize the path.

@mateoatr mateoatr requested review from brianrob and vitek-karas April 3, 2021 00:55
@ghost ghost added the area-Host label Apr 3, 2021
@ghost
Copy link

ghost commented Apr 3, 2021

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

In an effort to improve startup time, this PR gets rid of three different file-accessing calls inside the host:

if (pal::file_exists(additional_deps_path))

Which performs a file existence check on each of the assets inside a deps.json.

And:

pal::realpath(&real_asset_path);

Which purpose is to unroll the symbolic link of a given path and, in the later case, to later normalize the path.

Author: mateoatr
Assignees: -
Labels:

area-Host

Milestone: -

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically just some more interesting test cases, otherwise looks good.

Comment on lines 174 to 178
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Set code page to output unicode characters.
Command.Create("chcp 65001").Execute();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is disabled no Windows as per above if - maybe just leave a comment, that enabling this on Windows will require running this command.

else
{
trace::verbose(_X(" %s path query exists %s"), query_type, candidate.c_str());
trace::verbose(_X(" %s path query %s"), query_type, candidate.c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - maybe include (skipped existence check) or something like that, so that it's easy to determine what happened (I know the strings are different already, but they're very similar).

Comment on lines +223 to +224
StandaloneAppFixture_Localized = localizedFixture;
StandaloneAppFixture_Published = publishFixture;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple more tests we might want to add:

  • Framework dependent app - run it from a symlink
  • Framework dependent app where runtime install location is a symlink (basically DOTNET_ROOT points to a symlink)
  • Running an app via dotnet app.dll where the dotnet is a symlink. (I think this is close to the snap scenario)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more

  • Make sure we have a test to validate additional probing paths (that they continue to work even after this change)


// Given a "base" dir, yield the file path within this directory or single-file bundle.
bool to_dir_path(const pal::string_t& base, bool look_in_bundle, pal::string_t* str, bool& found_in_bundle) const;
bool to_dir_path(const pal::string_t& base, bool look_in_bundle, pal::string_t* str, bool& found_in_bundle, bool check_file_existence) const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would strongly recommend keeping the last parameter as the out. In this case we now have "in in out out in". Also, we now have two booleans in these cases which means we are close to warranting an enumeration. At the very least though all of these functions should be updated to keep the outs as the last parameters.

@mateoatr mateoatr marked this pull request as ready for review April 15, 2021 18:53
@mateoatr mateoatr merged commit fa49dbc into dotnet:main Apr 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 16, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants