You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Struct size of 128 bytes was observed to be the point at which `default` becomes slower in classic Mono, from benchmarks.
216
+
// For all types > 128 bytes, reading from a field is faster than `default`.
217
+
// Between 64 and 128 bytes, both methods are about the same speed.
218
+
privateconstintMonoDefaultCutoffSize=128;
219
+
220
+
// We use the fastest possible method to return a value of the workload return type in order to prevent the overhead method from taking longer than the workload method.
221
+
// Classic Mono runs `default` slower than reading a field for very large structs. `default` is faster for all types in all other runtimes.
// Note: the runtime pads structs for alignment purposes, and it enforces a minimum of 1 byte, even for empty structs,
246
+
// but we don't need to worry about either of those cases for the purpose this serves (calculating whether to use `default` or read a field in Mono for the overhead method).
// this method is used only for the disassembly diagnoser purposes
76
77
// the goal is to get this and the benchmarked method jitted, but without executing the benchmarked method itself
@@ -248,7 +249,6 @@
248
249
249
250
#elif RETURNS_BYREF_$ID$
250
251
251
-
private $WorkloadMethodReturnType$ overheadDefaultValueHolder = default($WorkloadMethodReturnType$); // Do NOT change name "overheadDefaultValueHolder" (used in ByRefDeclarationsProvider).
252
252
private BenchmarkDotNet.Engines.Consumer consumer = new BenchmarkDotNet.Engines.Consumer();
0 commit comments