Skip to content

Update filter.c #18740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update filter.c #18740

wants to merge 1 commit into from

Conversation

itashia
Copy link

@itashia itashia commented Jun 2, 2025

Refactor: Optimize performance, memory handling, and error management

  • Added optimization macros (e.g., UNEXPECTED) for rare branches
  • Used do_alloca / free_alloca for efficient temporary memory allocation
  • Replaced verbose conditionals with ternary operators where appropriate
  • Removed redundant condition checks
  • Improved variable grouping and naming for readability
  • Added clearer comments to explain logic
  • Used memmove instead of memcpy for overlapping memory regions
  • Calculated memory sizes more precisely
  • Introduced helper function php_stream_bucket_brigade_cleanup for repeated cleanup logic
  • Enhanced error handling with additional checks and better resource cleanup
  • Reduced redundant computations in loops
  • Improved memory access patterns for better loop performance

Refactor: Optimize performance, memory handling, and error management

- Added optimization macros (e.g., `UNEXPECTED`) for rare branches
- Used `do_alloca` / `free_alloca` for efficient temporary memory allocation
- Replaced verbose conditionals with ternary operators where appropriate
- Removed redundant condition checks
- Improved variable grouping and naming for readability
- Added clearer comments to explain logic
- Used `memmove` instead of `memcpy` for overlapping memory regions
- Calculated memory sizes more precisely
- Introduced helper function `php_stream_bucket_brigade_cleanup` for repeated cleanup logic
- Enhanced error handling with additional checks and better resource cleanup
- Reduced redundant computations in loops
- Improved memory access patterns for better loop performance
@itashia itashia requested a review from bukka as a code owner June 2, 2025 11:41
@TimWolla
Copy link
Member

TimWolla commented Jun 2, 2025

Hi. Thank you for your contributions. Unfortunately the PR is not in a state where it is meaningfully reviewable, because it combines a large number of unrelated changes into a single commit.

Can you please split your changes into individual atomic commits? Please also double-check the CODING_STANDARDS.md, particularly the instructions around indentation.

/* Compact read buffer if needed */
if (stream->readpos > 0) {
size_t valid_data = stream->writepos - stream->readpos;
memmove(stream->readbuf, stream->readbuf + stream->readpos, valid_data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sort of changes ought to be separated from the rest, it is not an improvement but a fix. So hidden by too much pointless changes too.

@jorgsowa
Copy link
Contributor

jorgsowa commented Jun 3, 2025

Seeing the shape of changes and the history of other contributions of author I have assumption that this was vibe coded.

@itashia, is it true?

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.

4 participants