Skip to content

GetTempPath hot in some benchmarks in Microsoft.ML.PerformanceTests #7277

@alexcovington

Description

@alexcovington

I have noticed that depending on the length of the temporary path, some benchmarks see a significant performance drop because of the need to convert from a Windows short name to a long name.

If I use the temporary directory path C:\tempdir\, the benchmark gives these performance results on my machine:

Microsoft.ML.PerformanceTests.exe --filter '*CreatePredictionEngine' --envVars TEMP:C:\tempdir TMP:C:\tempdir


| Method                 | Mean     | Error   | StdDev  | Extra Metric |
|----------------------- |---------:|--------:|--------:|-------------:|
| CreatePredictionEngine | 249.5 us | 4.80 us | 4.93 us |            - |

If I use a long temporary directory C:\Users\username\AppData\Local\Temp\ML.NET\A Very Very Long File Name That Will Be Converted To A Short Path\Temp (which has the short name C:\Users\username\AppData\Local\Temp\ML.NET\AVERYV~1\Temp), the benchmark shows significantly worse performance on the same machine:

 .\Microsoft.ML.PerformanceTests.exe --filter '*CreatePredictionEngine' --envVars TEMP:C:\Users\username\AppData\Local\Temp\ML.NET\AVERYV~1\Temp TMP:C:\Users\username\AppData\Local\Temp\ML.NET\AVERYV~1\Temp

| Method                 | Mean     | Error    | StdDev   | Extra Metric |
|----------------------- |---------:|---------:|---------:|-------------:|
| CreatePredictionEngine | 10.53 ms | 0.082 ms | 0.077 ms |            - |

Looking at this under PerfView, I see a lot of extra time spent here.

I'm wondering if it is possible to cache this lookup? It seems misleading for the benchmark performance to fluctuate so much because of the temporary directory path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedNew issue has not been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions