Posted in

微软发布 .NET 9 预览版 5_AI阅读总结 — 包阅AI

包阅导读总结

1. 关键词:.NET 9、Preview 5、性能改进、AI 能力、功能更新

2. 总结:上个月微软发布.NET 9 的第五个预览版,是标准长期支持版本,支持多操作系统 18 个月。此版本带来性能提升和诸多新功能,如增强的 AI 能力、优先无界通道、子串搜索等。

3. 主要内容:

– .NET 9 Preview 5 发布

– 预计今年晚些发布,为标准长期支持版本,支持多操作系统 18 个月。

– 性能改进和新功能

– 增强 AI 能力,包括更新 TensorPrimitives 和 Tensor 类型。

– 引入优先无界通道,通过新方法创建可按特定规则排序元素。

– SearchValues 类型扩展支持子串搜索。

– OpenTelemetry 活动链接更灵活。

– 包括新的 Task 相关 API 等其他更新。

– 可获取信息和适用系统

– 更多信息可通过链接获取,适用于 Linux、macOS 和 Windows 系统。

思维导图:

文章地址:https://www.infoq.com/news/2024/07/ms-releases-dotnet-9-preview5/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global

文章来源:infoq.com

作者:Arthur Casals

发布时间:2024/7/8 0:00

语言:英文

总字数:518字

预计阅读时间:3分钟

评分:82分

标签:.NET 9,AI 功能,性能改进,OpenTelemetry,Tensor 原语


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

Last month, Microsoft released the fifth preview of .NET 9. The new version of the framework, expected to be released later this year, is a Standard Term Support (STS) release and will be supported on multiple operating systems for 18 months, from November 12th, 2024, to May 12th, 2026. This preview brings performance improvements and features such as enhanced AI capabilities, prioritized unbounded channel, substring searching with SearchValues, and more flexible active linking in OpenTelemetry.

One of the most important features of this release is the expansion of its AI capabilities with updated versions of TensorPrimitives and the Tensor<T> type. The TensorPrimitive class provides static methods for performing numerical operations on spans of values. With the update, the scope of methods exposed by the class has been significantly expanded – from 40 (.NET 8) to approximately 200 overloads.The expansion includes overloads for any T that implements a certain interface. In terms of performance, many operations have been accelerated via SIMD-optimized implementations.

The new Tensor<T> type, introduced in the previous release, aims to provide efficient interop with AI libraries (like ML.NET). It also enables data manipulation by providing indexing and slicing operations, and since it builds on top of TensorPrimitives for math operations the new type also benefits from the TensorPrimitives updates.

Another interesting update in this release is the prioritized unbounded channel. An unbounded channel refers to a thread channel that has no limit on the number of items that may be stored. The new prioritized channel is provided with the addition of the method CreateUnboundedPrioritized<T> to the System.Threading.Channels library. The channel created by the new method orders its elements according to either Comparer<T>.Default or a custom IComparer<T> supplied to the factory method. The following example outputs the numbers 1 through 5 in order, even though they were written to the channel in a different order:

using System.Threading.Channels;Channel<int> c = Channel.CreateUnboundedPrioritized<int>();await c.Writer.WriteAsync(1);await c.Writer.WriteAsync(5);await c.Writer.WriteAsync(2);await c.Writer.WriteAsync(4);await c.Writer.WriteAsync(3);c.Writer.Complete();while (await c.Reader.WaitToReadAsync()){    while (c.Reader.TryRead(out int item))    {        Console.WriteLine(item);    }}

Source: Microsoft

The SearchValues type, introduced in .NET 8, provides an optimized solution for searching within spans. In .Net 9, the type has been extended to support searching for substrings within a larger string. This is another implementation optimized to take advantage of the SIMD support in the underlying platform. As a result, higher-level types that use this functionality as part of its implementation (like Regex) are also optimized.

OpenTelemetry activity linking is now more flexible with the addition of the System.Diagnostics.Activity.AddLink method. It enables linking an Activity object to other tracing contexts after the creation of the Activityobject, which better aligns with the OpenTelemetry specifications.

Other updates in this release include new APIs for working with Task– in particular, the new Task.WhenEach method, which allows for using an await foreach to iterate through tasks as they complete. It also includes trimming support for the TypeDescriptor class, a new TypeName class for parsing ECMA-335 type names, and better params performance with Spanoverloads.

You can find more information about this release here. .NET 9 Preview 5 is available for Linux, macOS, and Windows.