Skip to content
mentoor

Performance review of AI-written code

For engineers

Catching N+1 queries, hidden quadratic loops, memory growth and chatty I/O in AI code, and proving fixes by measuring

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

What is the clearest sign of an N+1 query problem in AI-written code?

Choose one answer

Check yourself · 2 of 5

A function loops over n items and calls list.index on a list of n items inside the loop. What is its time complexity?

Choose one answer

Check yourself · 3 of 5

An AI-written script calls an API once per item in a loop of 500 items, awaiting each call. What is the main cost?

Choose one answer

Check yourself · 4 of 5

Which line is the most likely cause of unbounded memory growth in a long-running service?

Choose one answer

Check yourself · 5 of 5

What should you do before asking an agent to optimise a slow endpoint?

Choose one answer

Topics

  1. Spotting N+1 database queries5 min read · ORM loops that fire one query per row, and fixes with joins, eager loading and batching
  2. Hidden quadratic loops in generated code5 min read · Nested scans, lookups inside loops, repeated sorting and string building that work on test data and fail at scale
  3. Chatty network calls and missing batching5 min read · Sequential awaits, per-item API calls, missing pagination and no caching in AI-written integrations
  4. Memory leaks and unbounded growth5 min read · Unbounded caches, listeners never removed, whole files or tables loaded into memory, and missing streaming
  5. Profiling and benchmarking before optimising5 min read · Profilers, flame graphs, query plans and benchmarks so neither you nor the agent optimises by guesswork

Start here

Helps to know first

110 questions · last verified 2026-12