Skip to content

Conversation

@paulsheldrake
Copy link

Summary

This PR moves from runtime dependencies () to development dependencies () to eliminate significant performance overhead in production environments.

Problem

Kint is currently loaded on every request in production, causing:

  • ~27ms execution time per request for composer metadata parsing
  • ~3MB memory usage for parsing 300+ package metadata
  • Runs before Drupal caching mechanisms can intercept

This overhead occurs because Kint's file automatically parses and files to look for configuration, which happens during Composer's autoload process on every request.

Solution

  • Move from to section
  • Remove duplicate entry from section
  • Preserve all debugging functionality in development environments
  • Eliminate production overhead when using

Impact

Production (with )

Eliminates ~27ms + 3MB overhead per request
No functionality loss (Kint shouldn't be in production)
Faster page loads and reduced memory usage

Development (with dev dependencies)

Kint remains fully available for debugging
No breaking changes to development workflow
All existing functionality preserved

Testing

  • Verified no runtime code uses Kint (only dev/test commands)
  • Confirmed RoboFile.php and Drush commands are dev-only tools
  • Tested that core module functionality is unaffected

Performance Evidence

This change addresses a performance bottleneck identified via XDebug profiling where Kint's JSON parsing of composer metadata was consuming significant resources on every request before any application-level caching could help.

Breaking Changes

None for typical usage. Only affects environments that:

  1. Use (production)
  2. AND try to use Kint debugging functions

Such usage would be incorrect anyway as debugging tools shouldn't be used in production.

- Moves kint-php/kint from runtime dependencies to dev dependencies
- Removes duplicate kint entry from suggest section
- Prevents ~27ms execution overhead and ~3MB memory usage per request in production
- Kint's composer metadata parsing runs before Drupal caching can help
- Only affects production environments with --no-dev installs
- Development environments retain full Kint debugging functionality

Resolves performance bottleneck where Kint parses 300+ package metadata
from composer/installed.json on every request for debugging functionality
that should not be present in production.
@paulsheldrake paulsheldrake requested a review from a team as a code owner September 26, 2025 19:17
@pwtyler pwtyler changed the title perf: Move kint-php/kint to dev dependencies to eliminate production overhead [SITE-5266] perf: Move kint-php/kint to dev dependencies to eliminate production overhead Sep 26, 2025
@pwtyler
Copy link
Member

pwtyler commented Sep 26, 2025

Hi @paulsheldrake, thanks for the PR— We've actually got an overhaul (#230) of search_api_pantheon that includes removing kint as a dependency entirely. At the moment It's actually called in a couple of commands in (Diagnose.php and TestIndexAndQuery.php) even thought it really shouldn't, so just moving it to dev deps would break the current exception handling. Hoping to get that PR in and the major version published soon, it got sidelined for a bit but we're back on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants