Skip to content

Commit 2cce095

Browse files
committed
Perftests: AggressiveInliningPerfTests - more realistic conditions for agressive inlining
1 parent 6b27f81 commit 2cce095

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Experimental/src/RangesV2/RangesV2PlannedChanges.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
## List of optimizations to do:
2-
* Agressive inlining and prooftest for it
2+
* DO WE NEED IT? Agressive inlining on struct constructors. Should measure first.
33
* DO WE NEED IT? factory methods for Nullable<T> => Range<T>;
44
Good part: ~2x speedup?
55
Bad part: GetValueOrDefault for infinity will return 0, not null.
66

77
## List of optimizations done:
8+
* prooftest AggressiveInliningPerfTests + AggressiveInlining annotations.
89
* Non-readonly fields:https://codeblog.jonskeet.uk/2014/07/16/micro-optimization-the-surprising-inefficiency-of-readonly-fields/
910

1011
## List of fixes:

Main/tests-performance/CalibrationBenchmarks/AggressiveInliningPerfTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,15 @@ public StructInline(T value, bool validate)
211211

212212
private static int CallManualInline(int i) => i + 1;
213213

214+
[MethodImpl(MethodImplOptions.NoInlining)]
214215
private static int CallAuto(int i) =>
215216
new StructAuto<int>(i, false).Value + 1;
216217

218+
[MethodImpl(MethodImplOptions.NoInlining)]
217219
private static int CallNoInline(int i) =>
218220
new StructNoInline<int>(i, false).Value + 1;
219221

220-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
222+
[MethodImpl(MethodImplOptions.NoInlining)]
221223
private static int CallInline(int i) =>
222224
new StructInline<int>(i, false).Value + 1;
223225
#endregion
@@ -233,7 +235,7 @@ public int Test00Baseline()
233235
return sum;
234236
}
235237

236-
[CompetitionBenchmark(5.82, 6.20)]
238+
[CompetitionBenchmark(5.80, 6.18)]
237239
public int Test01Auto()
238240
{
239241
var sum = 0;
@@ -244,7 +246,7 @@ public int Test01Auto()
244246
return sum;
245247
}
246248

247-
[CompetitionBenchmark(5.74, 6.12)]
249+
[CompetitionBenchmark(5.80, 6.20)]
248250
public int Test02NoInline()
249251
{
250252
var sum = 0;
@@ -255,7 +257,7 @@ public int Test02NoInline()
255257
return sum;
256258
}
257259

258-
[CompetitionBenchmark(0.98, 1.05)]
260+
[CompetitionBenchmark(2.60, 2.77)]
259261
public int Test03AggressiveInline()
260262
{
261263
var sum = 0;

0 commit comments

Comments
 (0)