Click here to Skip to main content
14,032,879 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

2.8K views
Posted 11 Feb 2019
Licenced CPOL

Are Speed Considerations Concerning List Still Important (Performance of Loyc's AList<T>)?

, 11 Feb 2019
Rate this:
Please Sign up or sign in to vote.
Compare the speed of generic collections running on .NET Framework 4.6.1, .NET Core 2.1 and Mono/.NET 4.5 based on the framework's version of List against Loys's version of AList.

Introduction

Recently, I was looking for a fast list and stumbled upon Loyc's AList<T>.

The AList<T> is part of a bunch of generic collection classes, that have been introduced here at Code Project already by Qwertie. In this tip, you'll find a simple comparison of performance, which I have missed in the original article.

Background

The generic collection classes of the .NET standard library do a very good job, especially:

  • for small and medium size collections and
  • primarily for element read access and append operations

Conversely, they tend to be less suitable:

  • for large lists and
  • insert-at or remove-at (random access) operations

Let's take a look at the performance...

Using the Code

I have prepared three solutions (.NET Framework 4.6, .NET Core 2.1 and Mono/.NET 4.5) with exactly the same test case - random access insert-at and delete-at operations. This is the only scenario, that is worth inspecting - in all other cases, the .NET standard library is the best choice.

Loyc's AList<T> is available as NuGet package, compiled for 'Any CPU' targeting .NET 4.5, and source code at GitHub, that supports multiple targets: ,NET 3.5, .NET 4.0 and .NET 4.5.

It is easy to integrate the NuGet packages into the .NET Framework 4.6.1 and the Mono/.NET 4.5 projects. To get Loyc's AList<T> running for .NET Core 2.1, I had to adopt the source code - but this was done in less than 10 minutes as well.

The performance comparison (linear scale - to get an impression of the difference between best and worst):

The performance comparison (logarithmic scale - to display even the small figures):

The raw figures:

How it looks running on Mono/.NET 4.5 (I've used VMWare Player 12.5.9 to run an openSUSE 13.3 64 Bit with 4GB RAM and 2 cores on an Intel(R) Core(TM) i7-5600U CPU):

How it looks running on .NET Framework 4.6.1 (I've used the same Intel(R) Core(TM) i7-5600U CPU):

How it looks running on .NET Core 2.1 (I've used the same Intel(R) Core(TM) i7-5600U CPU):

The Quintessence

  • Mono/.NET4.5 is the slowest environment for large list. Loyc performs very well in this scenario and is a good alternative.
  • .NET Core 2.1 outperforms Loyc.
  • .NET Framework 4.6.1 is better than Mono/.NET4.5 and worse than .NET Core 2.1. Loyc performs very well in this scenario and is a good alternative.

History

  • 11th February, 2019: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Steffen Ploetz
CEO Ploetz + Zeller GmbH
Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionScales of the graphs are not clearly labeled Pin
markchagers12-Feb-19 20:57
membermarkchagers12-Feb-19 20:57 
QuestionThe URL link is missing Pin
Fanliver11-Feb-19 16:41
memberFanliver11-Feb-19 16:41 
The AList<T> is part of a bunch of generic collection classes, that have been introduced here at CODE PROJECT 

The URL link in introduced here is incorrect. Please update it.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190423.1 | Last Updated 11 Feb 2019
Article Copyright 2019 by Steffen Ploetz
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid