gpt4 book ai didi

c# - C# 中最重要的优化性能最佳实践是什么

转载 作者:可可西里 更新时间:2023-11-01 08:16:34 27 4
gpt4 key购买 nike

<分区>

当我在阅读this tutorial我注意到以下有关在 C# 中使用结构的性能提示:

Unless you need reference type semantics, a class that is smaller than 16 bytes may be more efficiently handled by the system as a struct.

我在 stackoverflow 中查找了类似的问题,并在 ADO.Net 中找到了一些关于性能最佳实践的问题。 , Networking , Streams ,但与C#(语言)中的性能最佳实践无关。

我想添加另一个关于使用整数类型的提示:

The runtime optimizes the performance of 32-bit integer types (Int32 and UInt32), so use those types for counters and other frequently accessed integral variables.

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com