Skip to content

v0.4.0 - Performance Improvements

Latest
Compare
Choose a tag to compare
@EdmondDantes EdmondDantes released this 25 Sep 14:16
· 8 commits to main since this release

PHP Async Extension v0.4.0

This release focuses on three core performance optimizations that significantly improve async operation efficiency.

Core Performance Improvements

1. Minimizing Kernel Function Calls

  • Reduced unnecessary LibUV calls in scheduler tick processing
  • Optimized network_async_accept_incoming - attempt accept() before waiting
  • Separate queue for resumed coroutines to improve scheduler stability
  • Replaced expensive EG(exception) checks with direct bool returns in TrueAsync API

2. Event Descriptor Caching

  • Introduced zend_async_poll_proxy_t structure for efficient file descriptor management
  • Event handler caching for sockets - avoid EventLoop recreation overhead
  • Poll proxy event aggregation and improved lifecycle management
  • Automatic waker event cleanup when coroutines resume (ZEND_ASYNC_WAKER_CLEAN_EVENTS)

3. Memory Allocation Optimization

  • Fixed ref_count logic in zend_async_event_callback_t structures
  • Optimized waker trigger structures with improved memory layout
  • Enhanced memory allocation patterns for async structures
  • Better resource cleanup and lifecycle management

Additional Features

  • Full async UDP socket operations integrated with TrueAsync API
  • Implemented SSL support for socket streams

Bug Fixes

  • Fixed await iterator logic for awaitXXX functions
  • Resolved process waiting logic issues on UNIX-like systems
  • Fixed compilation errors in curl_async.c
  • Improved iterator state management in concurrent environments

Requirements

  • LibUV: >= 1.45.0 (upgraded from 1.44.0 to fix critical timer bugs)
  • PHP: 8.5+
  • Platforms: Linux, macOS, Windows, FreeBSD, etc.

API Changes

  • TrueAsync API functions now return bool instead of void for better performance
  • Automatic cleanup of waker events when coroutines resume

For detailed technical changes, see CHANGELOG.md.