tinycodinglm / code /code221.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 12)
3c88a0f verified
|
Raw History Blame
2.08 kB
deepseek-harness trace
System You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing c...

You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies.

User

How do I optimize application performance?

Assistant

Measurement First:

  • Profile before optimizing
  • Identify bottlenecks (CPU, memory, I/O, network)
  • Set performance budgets
  • Use APM tools (DataDog, New Relic, Pyroscope)

Algorithm Optimization:

  • Reduce complexity (O(n²) → O(n log n))
  • Choose right data structures
  • Avoid premature optimization
  • Cache expensive computations

Database Optimization:

  • Add indexes for query patterns
  • Avoid N+1 queries (eager loading)
  • Use connection pooling
  • Read replicas for scaling reads
  • Partition large tables

Caching Strategy:

  • Multi-level caching (local → distributed)
  • Cache invalidation strategy
  • Cache-aside pattern
  • HTTP caching headers

Frontend Performance:

  • Minimize bundle size
  • Code splitting (lazy loading)
  • Image optimization (WebP, lazy load)
  • Reduce render blocking resources
  • Use CDN

Backend Performance:

  • Async processing for non-critical work
  • Connection pooling
  • Efficient serialization (protobuf, msgpack)
  • Horizontal scaling
  • Load balancing

Profiling Tools:

  • Python: cProfile, py-spy, pyinstrument
  • Node: --inspect, clinic.js
  • Go: pprof
  • Java: JProfiler, async-profiler
  • Universal: perf, flamegraphs

Tips:

  • Measure, don't guess
  • Optimize the bottleneck
  • Consider trade-offs
  • Monitor in production
  • Set performance SLAs