Skip to content

Repository files navigation

Benchmarks

ClassVersusRecordMemory: Class vs Record in a list

This benchmark explores the benefits of using a record instead of a class.

MethodListSizeMeanErrorStdDevGen0Gen1Gen2Allocated
BenchmarkClassAllocations100018.81 us21.654 us1.187 us---32736 B
BenchmarkRecordsAllocations100012.00 us0.011 us0.001 us---736 B
BenchmarkClassAllocations1000071.22 us10.033 us0.550 us---320736 B
BenchmarkRecordsAllocations1000045.42 us14.838 us0.813 us---736 B
BenchmarkClassAllocations100000526.49 us253.009 us13.868 us---3200736 B
BenchmarkRecordsAllocations100000271.58 us111.876 us6.132 us---736 B
BenchmarkClassAllocations100000027,978.87 us9,155.867 us501.864 us6000.00003000.00001000.000032002576 B
BenchmarkRecordsAllocations10000002,453.68 us844.039 us46.265 us---736 B
BenchmarkClassAllocations10000000676,569.07 us88,963.177 us4,876.372 us54000.000020000.00003000.0000320002768 B
BenchmarkRecordsAllocations1000000024,265.59 us2,954.323 us161.936 us---736 B

Using the records in this case does not trigger additional allocations except for the one done when instantiating the list.

About

The repository is a sandbox and contains test code.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages