aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-01-12 15:28:02 +0100
committerBond_009 <bond.009@outlook.com>2021-01-12 15:28:02 +0100
commit1ea2b200c0b38f9d9a058f5e4b6e27815a016860 (patch)
treed036e97576d8ea45d6e397257f4364aef163e32c /Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs
parentaaf889f683a92b4c41c54505d91d96b902709843 (diff)
JsonSerializer deserialize from bytes where possible
This is faster and uses way less memory ``` BenchmarkDotNet=v0.12.1, OS=fedora 32 Intel Core i7-6700HQ CPU 2.60GHz (Skylake), 1 CPU, 8 logical and 4 physical cores .NET Core SDK=5.0.100 [Host] : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT DefaultJob : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT | Method | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | |------- |---------:|--------:|--------:|--------:|------:|------:|----------:| | Bytes | 158.4 us | 2.56 us | 2.14 us | 16.8457 | - | - | 52.08 KB | | String | 172.8 us | 0.78 us | 0.70 us | 41.5039 | - | - | 127.82 KB | | Custom | 155.5 us | 2.95 us | 2.76 us | 10.0098 | - | - | 31.27 KB | ```
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs')
-rw-r--r--Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs
index f4040748d..07829c696 100644
--- a/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs
+++ b/Jellyfin.Server/Migrations/Routines/MigrateDisplayPreferencesDb.cs
@@ -90,7 +90,7 @@ namespace Jellyfin.Server.Migrations.Routines
var results = connection.Query("SELECT * FROM userdisplaypreferences");
foreach (var result in results)
{
- var dto = JsonSerializer.Deserialize<DisplayPreferencesDto>(result[3].ToString(), _jsonOptions);
+ var dto = JsonSerializer.Deserialize<DisplayPreferencesDto>(result[3].ToBlob(), _jsonOptions);
if (dto == null)
{
continue;