# 성능 최적화 (.NET) > Profiling, BenchmarkDotNet, memory allocation, boxing/unboxing, Span, 성능 모범 사례 - 22 면접 질문 - Senior - [면접 질문: .NET](https://sharpskill.dev/ko/technologies/dotnet/interview-questions.md) ## 1. 성능을 측정할 때 단순한 Stopwatch에 비해 BenchmarkDotNet의 주요 장점은 무엇입니까? **답변** BenchmarkDotNet은 warm-up을 수행하고 통계적 안정화와 함께 여러 반복을 측정하며 JIT 및 GC 편향을 방지합니다. 단순한 Stopwatch는 이러한 요소를 제어하지 않으므로 대표성이 없는 결과를 줄 수 있습니다. BenchmarkDotNet은 작업당 메모리 할당과 같은 상세한 지표도 제공합니다. ## 2. 프로덕션에서 메모리 할당을 분석하고 메모리 누수를 식별하기 위해 권장되는 Microsoft 도구는 무엇입니까? **답변** JetBrains의 dotMemory와 Microsoft의 PerfView는 .NET에서 메모리를 프로파일링하기 위해 권장되는 도구입니다. PerfView는 무료 오픈소스이며 heap allocations, stack traces, GC 이벤트를 분석할 수 있습니다. 특히 큰 오버헤드 없이 프로덕션에서 메모리 누수를 진단하는 데 적합합니다. ## 3. FirstOrDefault()와 같은 LINQ 메서드에서 숨겨진 메모리 할당을 어떻게 식별합니까? **답변** MemoryDiagnoser 속성과 함께 BenchmarkDotNet을 사용하면 작업당 할당을 확인할 수 있습니다. LINQ의 lambda는 delegate를 통해 숨겨진 할당을 생성합니다. 단순한 foreach 루프로 교체하면 이러한 할당이 제거됩니다. PerfView는 할당 stack traces를 캡처하여 출처를 식별할 수도 있습니다. ## 19개 추가 질문 이용 가능 - BenchmarkDotNet에서 CPU 성능을 측정하고 코드 hotspot을 식별하려면 어떤 속성을 사용합니까? - Mean: 125.3 ns, StdDev: 45.2 ns를 보여주는 BenchmarkDotNet 결과를 어떻게 해석합니까? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 .NET 면접 주제 - [C# 기초](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-basics.md): 25개 질문, Junior - [LINQ & Delegates](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-linq-delegates.md): 20개 질문, Junior - [C# 언어 핵심 요소](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-language-essentials.md): 15개 질문, Junior - [ASP.NET Core 기초](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/aspnet-core-fundamentals.md): 18개 질문, Junior - [ASP.NET Core 요청 수명 주기](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/aspnet-core-request-lifecycle.md): 20개 질문, Junior - [Configuration & Settings](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/configuration-settings.md): 20개 질문, Junior - [애플리케이션 라이프사이클](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/application-lifecycle.md): 20개 질문, Junior - [Dependency Injection](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/dependency-injection.md): 24개 질문, Mid-Level - [Entity Framework Core](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/entity-framework-core.md): 25개 질문, Mid-Level - [Minimal APIs](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/minimal-apis.md): 18개 질문, Mid-Level - [Web API 개발](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/web-api-development.md): 22개 질문, Mid-Level - [ASP.NET Core의 Async](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/async-aspnet-core.md): 20개 질문, Mid-Level - [Authentication & Authorization](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/authentication-authorization.md): 18개 질문, Mid-Level - [HttpClient & 네트워킹](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/httpclient-networking.md): 20개 질문, Mid-Level - [JSON 직렬화](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/json-serialization.md): 20개 질문, Mid-Level - [Entity Framework Core 고급](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/ef-core-advanced.md): 25개 질문, Mid-Level - [C# 고급 기능](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/csharp-advanced-features.md): 20개 질문, Mid-Level - [Clean Architecture](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/clean-architecture.md): 20개 질문, Mid-Level - [Logging, Monitoring & Observability](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/logging-monitoring.md): 22개 질문, Mid-Level - [단위 테스트와 xUnit](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/unit-testing-xunit.md): 20개 질문, Mid-Level - [통합 테스트](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/integration-testing.md): 18개 질문, Mid-Level - [Docker & Containerization](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/docker-containerization.md): 16개 질문, Mid-Level - [NuGet 패키지 관리](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/nuget-package-management.md): 16개 질문, Mid-Level - [Memory Management & GC](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/memory-management-gc.md): 22개 질문, Senior - [리액티브 프로그래밍](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/reactive-programming.md): 24개 질문, Senior - [Async/await 및 패턴](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/async-await-patterns.md): 26개 질문, Senior - [.NET 디자인 패턴](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/dotnet-design-patterns.md): 24개 질문, Senior - [보안 및 모범 사례](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/security-best-practices.md): 24개 질문, Senior - [SignalR 및 실시간](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/signalr-realtime.md): 22개 질문, Senior - [마이크로서비스 아키텍처](https://sharpskill.dev/ko/technologies/dotnet/interview-questions/microservices-architecture.md): 25개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/dotnet/interview-questions/performance-optimization