Research Article
BibTex RIS Cite

Performance Analysis of Span Data Type in C# Programming Language

Year 2024, Issue: 1, 29 - 36, 01.10.2024
https://doi.org/10.46810/tdfd.1425662

Abstract

This study presents a comparative analysis of the Span data type in the C# programming language against other data types. Span is a data type supported in .NET Core 2.1 and later versions, and this research investigates its impact on method performance and memory usage. The primary objective of the study is to highlight the potential advantages of the Span data type for C# developers. In pursuit of this goal, the study examines the performance effects of the Span data type through comparative analyses using various methods. For instance, when comparing the StringReplace and SpanReplace methods over 1000 iterations, it is observed that SpanReplace is significantly faster. Similarly, analyses conducted on methods like Contains used in data types such as Queue, List, and Stack demonstrate the performance advantages of the Span data type. In scenarios where the Span data type is employed, it is determined that memory consumption is lower compared to other data types. These findings can assist C# programmers in understanding the potential of the Span data type and optimizing their code accordingly. The Span data type may be a more effective option, especially in data processing and performance-sensitive applications.

References

  • Deshmukh R, Li R, Sen RR, Henry M, Beckwith G, Gupta G. Performance characterization of .NET benchmarks. IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS); 2021 Apr. Stony Brook, NY, USA. p. 107-17. doi: 10.1109/ISPASS51385.2021.00028.
  • Almada A. Performance of value-type vs. reference-type enumerators in C# [Internet]. 2023 Jul 22 [cited 2023 Jul 22]. Available from: https://www.linkedin.com/pulse/performance-value-type-vs-reference-type-enumerators-ant%C3%A3o-almada/
  • Usman M, Bajwa Z, Afzal M. Performance analysis of searching algorithms in C#. International Journal for Research in Applied Science & Engineering Technology (IJRASET). 2014;2(4):511-3.
  • Shastri S, Singh A, Mohan B, Mansotra V. Run-time analysis of searching and hashing algorithms with C# [Internet]. 2016 Dec [cited 2016 Dec]. Available from: https://www.researchgate.net/publication/311541937_Run-Time_Analysis_of_Searching_and_Hashing_Algorithms_with_C#
  • Arif MA, Hossain MS, Nahar N, Khatun MD. An empirical analysis of C#, PHP, JAVA, JSP and ASP.Net regarding performance analysis based on CPU utilization. Banglavision Research Journal. 2014;14(1):174-88.
  • Sestoft P. Numeric performance in C, C# and Java [Internet]. 2007 Feb 28 [cited 2007 Feb 28]. Available from: https://www.researchgate.net/publication/228380860_Numeric_performance_in_C_C_and_Java
  • The Tech Platform. Why and how string is immutable in C# [Internet]. 2021 Oct [cited 2021 Oct]. Available from: https://www.thetechplatform.com/post/why-and-how-string-is-immutable-in-c
  • Wickramarathna N. An introduction to writing high-performance C# using Span<T> struct [Internet]. 2021 Dec [cited 2021 Dec]. Available from: https://nishanc.medium.com/an-introduction-to-writing-high-performance-c-using-span-t-struct-b859862a84e4
  • BenchmarkDotNet. BenchmarkDotNet: Powerful .NET library for benchmarking [Internet]. 2024 Jan [cited 2024 Jan]. Available from: https://github.com/dotnet/BenchmarkDotNet
  • CodeAcademy. Contains() [Internet]. 2023 Apr [cited 2023 Apr]. Available from: https://www.codecademy.com/resources/docs/c-sharp/strings/contains
  • Tripathi P. Binary search using C# [Internet]. 2023 Nov [cited 2023 Nov]. Available from: https://www.c-sharpcorner.com/blogs/binary-search-implementation-using-c-sharp1
  • Microsoft. ArraySegment<T>.Slice Method [Internet]. 2024 Jan [cited 2024 Jan]. Available from: https://learn.microsoft.com/en-us/dotnet/api/system.arraysegment-1.slice?view=net-8.0
  • Geeks for Geeks. C# | Replace() method [Internet]. 2019 May [cited 2019 May]. Available from: https://www.geeksforgeeks.org/c-sharp-replace-method/
  • Microsoft. String.StartsWith Method [Internet]. 2024 Jan [cited 2024 Jan]. Available from: https://learn.microsoft.com/en-us/dotnet/api/system.string.startswith?view=net-8.0
Year 2024, Issue: 1, 29 - 36, 01.10.2024
https://doi.org/10.46810/tdfd.1425662

Abstract

References

  • Deshmukh R, Li R, Sen RR, Henry M, Beckwith G, Gupta G. Performance characterization of .NET benchmarks. IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS); 2021 Apr. Stony Brook, NY, USA. p. 107-17. doi: 10.1109/ISPASS51385.2021.00028.
  • Almada A. Performance of value-type vs. reference-type enumerators in C# [Internet]. 2023 Jul 22 [cited 2023 Jul 22]. Available from: https://www.linkedin.com/pulse/performance-value-type-vs-reference-type-enumerators-ant%C3%A3o-almada/
  • Usman M, Bajwa Z, Afzal M. Performance analysis of searching algorithms in C#. International Journal for Research in Applied Science & Engineering Technology (IJRASET). 2014;2(4):511-3.
  • Shastri S, Singh A, Mohan B, Mansotra V. Run-time analysis of searching and hashing algorithms with C# [Internet]. 2016 Dec [cited 2016 Dec]. Available from: https://www.researchgate.net/publication/311541937_Run-Time_Analysis_of_Searching_and_Hashing_Algorithms_with_C#
  • Arif MA, Hossain MS, Nahar N, Khatun MD. An empirical analysis of C#, PHP, JAVA, JSP and ASP.Net regarding performance analysis based on CPU utilization. Banglavision Research Journal. 2014;14(1):174-88.
  • Sestoft P. Numeric performance in C, C# and Java [Internet]. 2007 Feb 28 [cited 2007 Feb 28]. Available from: https://www.researchgate.net/publication/228380860_Numeric_performance_in_C_C_and_Java
  • The Tech Platform. Why and how string is immutable in C# [Internet]. 2021 Oct [cited 2021 Oct]. Available from: https://www.thetechplatform.com/post/why-and-how-string-is-immutable-in-c
  • Wickramarathna N. An introduction to writing high-performance C# using Span<T> struct [Internet]. 2021 Dec [cited 2021 Dec]. Available from: https://nishanc.medium.com/an-introduction-to-writing-high-performance-c-using-span-t-struct-b859862a84e4
  • BenchmarkDotNet. BenchmarkDotNet: Powerful .NET library for benchmarking [Internet]. 2024 Jan [cited 2024 Jan]. Available from: https://github.com/dotnet/BenchmarkDotNet
  • CodeAcademy. Contains() [Internet]. 2023 Apr [cited 2023 Apr]. Available from: https://www.codecademy.com/resources/docs/c-sharp/strings/contains
  • Tripathi P. Binary search using C# [Internet]. 2023 Nov [cited 2023 Nov]. Available from: https://www.c-sharpcorner.com/blogs/binary-search-implementation-using-c-sharp1
  • Microsoft. ArraySegment<T>.Slice Method [Internet]. 2024 Jan [cited 2024 Jan]. Available from: https://learn.microsoft.com/en-us/dotnet/api/system.arraysegment-1.slice?view=net-8.0
  • Geeks for Geeks. C# | Replace() method [Internet]. 2019 May [cited 2019 May]. Available from: https://www.geeksforgeeks.org/c-sharp-replace-method/
  • Microsoft. String.StartsWith Method [Internet]. 2024 Jan [cited 2024 Jan]. Available from: https://learn.microsoft.com/en-us/dotnet/api/system.string.startswith?view=net-8.0
There are 14 citations in total.

Details

Primary Language English
Subjects Information Systems (Other)
Journal Section Articles
Authors

Hakan Akdoğan 0009-0000-5067-268X

Halil İbrahim Duymaz This is me 0009-0005-8406-8831

Nadir Kocakır This is me 0000-0001-7421-0631

Önder Karademir This is me 0000-0001-5757-7335

Publication Date October 1, 2024
Submission Date January 25, 2024
Acceptance Date March 7, 2024
Published in Issue Year 2024 Issue: 1

Cite

APA Akdoğan, H., Duymaz, H. İ., Kocakır, N., Karademir, Ö. (2024). Performance Analysis of Span Data Type in C# Programming Language. Türk Doğa Ve Fen Dergisi(1), 29-36. https://doi.org/10.46810/tdfd.1425662
AMA Akdoğan H, Duymaz Hİ, Kocakır N, Karademir Ö. Performance Analysis of Span Data Type in C# Programming Language. TJNS. October 2024;(1):29-36. doi:10.46810/tdfd.1425662
Chicago Akdoğan, Hakan, Halil İbrahim Duymaz, Nadir Kocakır, and Önder Karademir. “Performance Analysis of Span Data Type in C# Programming Language”. Türk Doğa Ve Fen Dergisi, no. 1 (October 2024): 29-36. https://doi.org/10.46810/tdfd.1425662.
EndNote Akdoğan H, Duymaz Hİ, Kocakır N, Karademir Ö (October 1, 2024) Performance Analysis of Span Data Type in C# Programming Language. Türk Doğa ve Fen Dergisi 1 29–36.
IEEE H. Akdoğan, H. İ. Duymaz, N. Kocakır, and Ö. Karademir, “Performance Analysis of Span Data Type in C# Programming Language”, TJNS, no. 1, pp. 29–36, October 2024, doi: 10.46810/tdfd.1425662.
ISNAD Akdoğan, Hakan et al. “Performance Analysis of Span Data Type in C# Programming Language”. Türk Doğa ve Fen Dergisi 1 (October 2024), 29-36. https://doi.org/10.46810/tdfd.1425662.
JAMA Akdoğan H, Duymaz Hİ, Kocakır N, Karademir Ö. Performance Analysis of Span Data Type in C# Programming Language. TJNS. 2024;:29–36.
MLA Akdoğan, Hakan et al. “Performance Analysis of Span Data Type in C# Programming Language”. Türk Doğa Ve Fen Dergisi, no. 1, 2024, pp. 29-36, doi:10.46810/tdfd.1425662.
Vancouver Akdoğan H, Duymaz Hİ, Kocakır N, Karademir Ö. Performance Analysis of Span Data Type in C# Programming Language. TJNS. 2024(1):29-36.

This work is licensed under the Creative Commons Attribution-Non-Commercial-Non-Derivable 4.0 International License.