Consider batching calls to GC.AddMemoryPressure
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp
- Área
- performance
Línea de trabajo
Comienza localizando las llamadas existentes a GC.AddMemoryPressure y GC.RemoveMemoryPressure, así como el benchmark descrito en el issue. Compara el comportamiento del umbral agrupado de 64 KB entre las versiones de .NET indicadas y considera terminado el trabajo cuando los resultados del benchmark muestren una reducción de la sobrecarga de las colecciones sin una contabilidad incorrecta de la presión de memoria.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the enhancement requested
In an internal project where I'm looking at the overhead of translating JSON responses into Arrow, I'm seeing the following performance characteristics:
.NET 4.7.2
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated |
|---|---|---|---|---|---|---|---|
| SystemTextJson | 663.9 us | 3.32 us | 3.10 us | 58.5938 | 19.5313 | - | 366.89 KB |
| Arrow | 666.3 us | 5.77 us | 5.11 us | 7756.8359 | 965.8203 | 117.1875 | 97.06 KB |
.NET 8.0
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated |
|---|---|---|---|---|---|---|---|
| SystemTextJson | 285.6 us | 1.00 us | 0.94 us | 23.4375 | 11.7188 | - | 363.92 KB |
| Arrow | 334.2 us | 6.46 us | 6.34 us | 199.7070 | 199.7070 | 199.7070 | 52.17 KB |
.NET 10.0
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated |
|---|---|---|---|---|---|---|---|
| SystemTextJson | 267.2 us | 1.42 us | 1.26 us | 23.4375 | 14.1602 | - | 362.37 KB |
| Arrow | 331.9 us | 6.23 us | 5.83 us | 198.7305 | 198.7305 | 198.7305 | 48.44 KB |
When I effectively remove the calls to GC.AddMemoryPressure and GC.RemoveMemoryPressure but make no other changes, I instead get the following:
.NET 4.7.2
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| SystemTextJson | 661.6 us | 3.45 us | 3.23 us | 58.5938 | 19.5313 | 366.91 KB |
| Arrow | 453.6 us | 8.35 us | 7.81 us | 7.8125 | 3.9063 | 53.68 KB |
.NET 8.0
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| SystemTextJson | 288.0 us | 2.57 us | 2.41 us | 23.4375 | 11.7188 | 363.92 KB |
| Arrow | 277.9 us | 4.47 us | 3.73 us | 2.9297 | 2.4414 | 52.11 KB |
.NET 10.0
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| SystemTextJson | 270.4 us | 1.77 us | 1.66 us | 23.4375 | 14.1602 | 362.37 KB |
| Arrow | 274.6 us | 3.46 us | 3.24 us | 2.9297 | 2.4414 | 48.3 KB |
The amount allocated by the "SystemTextJson" test is a reasonable proxy for the amount of native memory allocated by the "Arrow" test. Especially under .NET 4.7.2, it appears that these calls are triggering frequent garbage collection which (at least in a microbenchmark) are having a large effect on performance.
One way to deal with this is to effectively batch the calls. For instance, we might consider rounding up to 64 KB and only adding or removing memory pressure when we go past that threshold. For instance, the first allocation of 128 bytes would add 64 KB, then subsequent allocations of 128 bytes, 4096 bytes, 8192 bytes and 32768 bytes would only increment an internal counter. At that point, an allocation of 40000 bytes would push us past the next 64 KB boundary and trigger another GC.AddMemoryPressure for another 64 KB.
It's possible, of course, that the benchmark is pathological due to an overall heap size which is quite small at that point and that in a "real" application we would not see this kind of noise. I'll try to figure out a way to measure that.
- Lenguaje dominante
- C#
- Estrellas
- 42
- Forks
- 31
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 12
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/arrow-dotnet
-
ArrowArrayConcatenator throws on a zero-length string/binary array with an empty offsets bufferAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
apache/arrow-dotnet#462 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
apache/arrow-dotnet#410 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
apache/arrow-dotnet#464 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
apache/arrow-dotnet#409 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/arrow-dotnet#397 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/arrow-dotnet
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
nightscout/nocturne#2135 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Devolutions/UniGetUI#5541 ·
Los mantenedores suelen responder en 1 día
-
[aw] PR Iteration Agent 🔧 failedAbiertoagentic-workflows Needs: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
[誤判定]Abiertolinux アプリ: ブラウザー 再現済み 要トリアージ 誤判定
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
yksr-melt/Meltype#853 · 2 comentarios ·
Los mantenedores suelen responder en 1 día