mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
[PR #15916] [MERGED] Optimize StringHelper.FirstToUpper()
#14466
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/15916
Author: @stevenaw
Created: 12/31/2025
Status: ✅ Merged
Merged: 1/3/2026
Merged by: @Bond-009
Base:
master← Head:optimize-tofirstupper📝 Commits (1)
e5fb071Optimize StringHelper.ToFirstUpper()📊 Changes
1 file changed (+4 additions, -5 deletions)
View changed files
📝
MediaBrowser.Model/Extensions/StringHelper.cs(+4 -5)📄 Description
Optimize
StringHelper.FirstToUpper(). This is primarily used at the moment to ensure theCultureInfo.DisplayName, when included in the MediaStream'sDisplayTitle, will always have a leading capital.Changes
Change an iterative char-by-char copy to a block copy. On my machine there is a small 1ns performance penalty for the single-character case but already at a 5-character string this optimized version runs in 80% of the time. A 25-character string is almost 2x as fast as the original implementation. I would expect any usages of this which pass in a language's
DisplayNameto usually be at least 5 or more characters long.Issues
Fixes https://github.com/jellyfin/jellyfin/issues/15915
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.