Skip to content

Annotate is native aot compatible #1543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

OleRoss
Copy link

@OleRoss OleRoss commented Apr 13, 2025

Dupliate of deleted #1532

OleRoss added 2 commits April 25, 2025 18:44
- Add IsAotCompatible to UnitsNet
  - Added EnumHelpers which provides a way to get enum values independent of target platform
  - Replaced generation of `GetQuantityTypes` with `RegisterDefaultConversions` to avoid reflection
- Add IsAotCompatible to UnitsNet.NumberExtensions
- Add IsAotCompatible to UnitsNet.JsonNet
@OleRoss OleRoss force-pushed the annotate-is-native-aot-compatible branch from fdb3f93 to ee4acd1 Compare April 25, 2025 17:14
@OleRoss
Copy link
Author

OleRoss commented Apr 25, 2025

@angularsen I rebased on the current master - it was much easier due to the latest commits

And, just for fun, I added a startup performance comparison :)

Default startup performance (PerfTest_Startup):

| Name      | Mean            | StdDev        | StdErr       | Min             | Max             | P95             | P90             | Outliers |
| --------- | --------------- | ------------- | ------------ | --------------- | --------------- | --------------- | --------------- | -------- |
| Default   | 2463,4326ms     | 386,9283ms    | 88,7674ms    | 1930,7473ms     | 3242,5405ms     | 3182,9327ms     | 3017,8285ms     | 1        |

NativeAot compilation startup performance (PerfTest_Startup_Aot):

| Name    | Mean      | StdDev   | StdErr    | Min        | Max        | P95        | P90 | Outliers |
| ------- | --------- | -------- | --------- | ---------- | ---------- | ---------- | --- | -------- |
| Default | 186,438ms | 47,942ms | 10,9986ms | 280,4149ms | 279,2135ms | 275,9632ms | 1   |          |

@lipchev
Copy link
Collaborator

lipchev commented Apr 25, 2025

@angularsen I rebased on the current master - it was much easier due to the latest commits

And, just for fun, I added a startup performance comparison :)

Default startup performance (PerfTest_Startup):

| Name      | Mean            | StdDev        | StdErr       | Min             | Max             | P95             | P90             | Outliers |
| --------- | --------------- | ------------- | ------------ | --------------- | --------------- | --------------- | --------------- | -------- |
| Default   | 2463,4326ms     | 386,9283ms    | 88,7674ms    | 1930,7473ms     | 3242,5405ms     | 3182,9327ms     | 3017,8285ms     | 1        |

NativeAot compilation startup performance (PerfTest_Startup_Aot):

| Name    | Mean      | StdDev   | StdErr    | Min        | Max        | P95        | P90 | Outliers |
| ------- | --------- | -------- | --------- | ---------- | ---------- | ---------- | --- | -------- |
| Default | 186,438ms | 47,942ms | 10,9986ms | 280,4149ms | 279,2135ms | 275,9632ms | 1   |          |

@OleRoss I haven't been able to do my own aot-enabled publish (haven't installed the c++ stuff yet), but am very curious to see how the 🐲 version performs: if you got the time, could you please run it against this PR: #1544

@OleRoss
Copy link
Author

OleRoss commented Apr 26, 2025

@lipchev, sure, I played around with it, but had difficulties getting comparable results ...

I ended up creating a benchmark class which starts a process and waits for completion:

Run 1: IterationCount=20  LaunchCount=8  WarmupCount=5

| Method                         | Mean     | Error   | StdDev   |
|------------------------------- |---------:|--------:|---------:|
| MeasureStartupQuantityValue    | 869.8 ms | 6.28 ms | 23.37 ms |
| MeasureStartupQuantityValueAot | 204.2 ms | 3.39 ms | 12.59 ms |
| MeasureStartupMaster           | 491.9 ms | 3.51 ms | 12.75 ms |
| MeasureStartupMasterAot        | 171.7 ms | 1.48 ms |  5.49 ms |

Run 2: IterationCount=20  LaunchCount=8  WarmupCount=5

| Method                         | Mean     | Error   | StdDev   | Median   |
|------------------------------- |---------:|--------:|---------:|---------:|
| MeasureStartupMaster           | 535.9 ms | 4.45 ms | 16.33 ms | 534.7 ms |
| MeasureStartupMasterAot        | 181.8 ms | 9.68 ms | 36.27 ms | 173.1 ms |
| MeasureStartupQuantityValue    | 798.5 ms | 7.67 ms | 28.29 ms | 792.3 ms |
| MeasureStartupQuantityValueAot | 200.9 ms | 1.78 ms |  6.60 ms | 199.7 ms |

Between Run 1 and Run 2, I changed the order of the tests; Somehow, the tests seem to be affected by this, but I think the trend is clear.

Apart from that, those are the results using timeitsharp (very inconsistent, just for completeness):

fractional-quantity-value:

| Name        | Mean        | StdDev      | StdErr      | Min         | Max         | P95         | P90        | Outliers |
| ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ---------- | -------- |
| Default     | 1737,353ms  | 321,2004ms  | 73,6884ms   | 1378,0007ms | 2417,7457ms | 2345,5968ms | 2174,4889m | 1        |

fractional-quantity-value AOT:

| Name    | Mean       | StdDev    | StdErr   | Min        | Max       | P95        | P90 | Outliers |
| ------- | ---------- | --------- | -------- | ---------- | --------- | ---------- | --- | -------- |
| Default | 106,8239ms | 11,6117ms | 2,7369ms | 142,3908ms | 136,828ms | 118,7921ms | 2   |          |


master:

| Name        | Mean        | StdDev      | StdErr      | Min        | Max         | P95         | P90         | Outliers |
| ----------- | ----------- | ----------- | ----------- | ---------- | ----------- | ----------- | ----------- | -------- |
| Default     | 955,7565ms  | 200,4313ms  | 45,9821ms   | 739,7095ms | 1324,9328ms | 1324,5596ms | 1312,1677ms | 1        |

master AOT:

| Name    | Mean       | StdDev    | StdErr   | Min        | Max      | P95        | P90 | Outliers |
| ------- | ---------- | --------- | -------- | ---------- | -------- | ---------- | --- | -------- |
| Default | 108,8349ms | 10,5986ms | 2,3699ms | 127,2372ms | 125,85ms | 123,0387ms | 0   |          |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants