Research Article

Performance Analysis of Span Data Type in C# Programming Language

Number: 1 October 1, 2024
EN

Performance Analysis of Span Data Type in C# Programming Language

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.

Keywords

References

  1. 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.
  2. 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/
  3. 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.
  4. 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#
  5. 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.
  6. 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
  7. 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
  8. Wickramarathna N. An introduction to writing high-performance C# using Span 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

Details

Primary Language

English

Subjects

Information Systems (Other)

Journal Section

Research Article

Publication Date

October 1, 2024

Submission Date

January 25, 2024

Acceptance Date

March 7, 2024

Published in Issue

Year 2024 Number: 1

APA
Akdoğan, H., Duymaz, H. İ., Kocakır, N., & Karademir, Ö. (2024). Performance Analysis of Span Data Type in C# Programming Language. Turkish Journal of Nature and Science, 1, 29-36. https://doi.org/10.46810/tdfd.1425662
AMA
1.Akdoğan H, Duymaz Hİ, Kocakır N, Karademir Ö. Performance Analysis of Span Data Type in C# Programming Language. TJNS. 2024;(1):29-36. doi:10.46810/tdfd.1425662
Chicago
Akdoğan, Hakan, Halil İbrahim Duymaz, Nadir Kocakır, and Önder Karademir. 2024. “Performance Analysis of Span Data Type in C# Programming Language”. Turkish Journal of Nature and Science, no. 1: 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. Turkish Journal of Nature and Science 1 29–36.
IEEE
[1]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, Oct. 2024, doi: 10.46810/tdfd.1425662.
ISNAD
Akdoğan, Hakan - Duymaz, Halil İbrahim - Kocakır, Nadir - Karademir, Önder. “Performance Analysis of Span Data Type in C# Programming Language”. Turkish Journal of Nature and Science. 1 (October 1, 2024): 29-36. https://doi.org/10.46810/tdfd.1425662.
JAMA
1.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”. Turkish Journal of Nature and Science, no. 1, Oct. 2024, pp. 29-36, doi:10.46810/tdfd.1425662.
Vancouver
1.Hakan Akdoğan, Halil İbrahim Duymaz, Nadir Kocakır, Önder Karademir. Performance Analysis of Span Data Type in C# Programming Language. TJNS. 2024 Oct. 1;(1):29-36. doi:10.46810/tdfd.1425662

Cited By