aspnet / Benchmarks

Benchmarks for ASP.NET Core
Other
1.18k stars 241 forks source link

How is the application size computed #1895

Closed NinoFloris closed 1 year ago

NinoFloris commented 1 year ago

Looking at scenarios under Native AOT here https://msit.powerbi.com/view?r=eyJrIjoiYTZjMTk3YjEtMzQ3Yi00NTI5LTg5ZDItNmUyMGRlOTkwMGRlIiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9.

It's odd JsonGin reports the application size as being around ~1 MB (which is based on https://github.com/aspnet/Benchmarks/blob/main/scenarios/te.benchmarks.yml#L45).

Go is good but not that good...

Doing a docker build locally and doing a docker run [image] ls -l --block-size=KB produces the more expected result of -rwxr-xr-x 1 root root 14815kB Aug 22 14:27 hello so about 15 MB instead.

sebastienros commented 1 year ago

Crank is doing docker inspect -f "{{ .Size }}" [container], so in this case it's probably taking the whole container size into account, not just the added binaries. I assume we could use a custom argument to point to the folder containing the app. But the whole container size is also useful for use (c.f. container page in the same dashboard)

sebastienros commented 1 year ago

Well, my explanation is actually countering the numbers... some investigation needs to be done.

sebastienros commented 1 year ago

Source: https://github.com/dotnet/crank/blob/main/src/Microsoft.Crank.Agent/Startup.cs#L2102C52-L2124

NinoFloris commented 1 year ago

No uh... you're right, you see it's a classic case of scanning numbers and getting decimal separators mixed up...

The dashboard correctly states the entire container is a gig+, explainable given the build + sdk + restore was done in the same step. (see dockerfile https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Go/gin/gin.dockerfile)

Thanks for the crank source link, might come in handy another time 😅