Skip to content

Commit 4e54f34

Browse files
committed
update readme
1 parent 748b44a commit 4e54f34

File tree

1 file changed

+46
-19
lines changed

1 file changed

+46
-19
lines changed

README.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
44
[![PHP Extension](https://img.shields.io/badge/PHP-Extension-777BB4.svg?logo=php)](https://www.php.net/)
55
[![RFC 4180](https://img.shields.io/badge/RFC%204180-Compliant-brightgreen.svg)](https://tools.ietf.org/html/rfc4180)
6-
[![Tests](https://img.shields.io/badge/tests-9%2F12%20passing-yellow.svg)](tests/)
6+
[![Tests](https://img.shields.io/badge/tests-12%2F12%20passing-brightgreen.svg)](tests/)
77
[![Memory Safe](https://img.shields.io/badge/memory-safe-brightgreen.svg)](lib/)
88
[![Performance](https://img.shields.io/badge/performance-high-blue.svg)](README.md#performance)
99

@@ -24,7 +24,7 @@ A high-performance PHP extension for reading and writing CSV files with full RFC
2424
- CRLF and LF line ending support
2525
- Immediate or buffered write operations
2626
- **Memory Efficient**: Arena-based memory management for optimal performance
27-
- **Comprehensive Testing**: Extensive test suite with 75% pass rate (9/12 tests passing)
27+
- **Comprehensive Testing**: Extensive test suite with 100% pass rate (12/12 tests passing)
2828

2929
## Classes
3030

@@ -108,7 +108,7 @@ $config->setWriteBOM(false); // Write BOM for Unicode files (default: false)
108108

109109
### Prerequisites
110110

111-
- PHP 7.4+ or PHP 8.x
111+
- PHP 8.x
112112
- GCC or compatible C compiler
113113
- PHP development headers (`php-dev` package)
114114

@@ -173,11 +173,9 @@ php run-tests.php -v tests/
173173

174174
### Current Test Status
175175

176-
- **Passing**: 9/12 tests (75% success rate)
177-
- **Known Issues**:
178-
- Performance test may show early termination on large datasets
179-
- Minor formatting discrepancies in edge cases
180-
- Writer quoting behavior in specific scenarios
176+
- **Passing**: 12/12 tests (100% success rate)
177+
- **Comprehensive Coverage**: Edge cases, performance, memory management, and RFC 4180 compliance
178+
- **Stable**: All tests consistently pass across different environments
181179

182180
## Technical Details
183181

@@ -211,14 +209,48 @@ Full compliance with CSV standard including:
211209

212210
## Performance
213211

214-
The extension is optimized for high-performance CSV processing:
212+
The extension is optimized for high-performance CSV processing with significant improvements over PHP's native SplFileObject:
213+
214+
### Benchmark Results (PHP 8.4.8, 1GB Memory Limit)
215+
216+
#### Read Operations Performance
217+
218+
| Data Size | Implementation | Median Time (ms) | Throughput (records/sec) | Speed Improvement |
219+
|-----------|----------------|------------------|--------------------------|-------------------|
220+
| Small (1K rows) | FastCSV | 3.67 | 272,410 | **4.1x faster** |
221+
| | SplFileObject | 15.03 | 66,520 | |
222+
| Medium (100K rows) | FastCSV | 176.04 | 568,049 | **3.6x faster** |
223+
| | SplFileObject | 639.51 | 156,370 | |
224+
| Large (1M rows) | FastCSV | 1,987.23 | 503,212 | **4.8x faster** |
225+
| | SplFileObject | 9,468.64 | 105,612 | |
226+
227+
#### Combined Read/Write Operations
228+
229+
| Data Size | Implementation | Median Time (ms) | Throughput (records/sec) | Speed Improvement |
230+
|-----------|----------------|------------------|--------------------------|-------------------|
231+
| Small (1K rows) | FastCSV | 22.76 | 87,870 | **1.6x faster** |
232+
| | SplFileObject | 35.5 | 56,341 | |
233+
| Medium (100K rows) | FastCSV | 590.78 | 338,535 | **2.5x faster** |
234+
| | SplFileObject | 1,469.31 | 136,118 | |
235+
| Large (1M rows) | FastCSV | 7,088.8 | 282,135 | **2.9x faster** |
236+
| | SplFileObject | 20,513.19 | 97,498 | |
237+
238+
### Key Performance Advantages
239+
240+
- **Read Operations**: 3.6x to 4.8x performance improvement over SplFileObject
241+
- **Combined Operations**: 1.6x to 2.9x advantage for read/write operations
242+
- **Scalability**: Performance advantage increases with data size
243+
- **Memory Efficiency**: Constant ~2MB memory usage regardless of file size
244+
- **Consistency**: Lower standard deviation, indicating more predictable performance
245+
246+
### Technical Performance Features
247+
248+
- **Native C Implementation**: Direct memory access and optimized algorithms
249+
- **Arena Memory Management**: Efficient bulk allocations and minimal fragmentation
250+
- **Streaming Operations**: Constant memory usage regardless of file size
251+
- **RFC 4180 Optimized**: Fast parsing with proper quote handling
215252

216-
- Native C implementation
217-
- Arena-based memory management
218-
- Efficient parsing algorithms
219-
- Minimal PHP object overhead
220253

221-
Benchmarks show significant performance improvements over pure PHP implementations, especially for large files.
222254

223255
## Contributing
224256

@@ -239,10 +271,5 @@ This project is licensed under the terms specified in the [LICENSE](LICENSE) fil
239271
- **Error Handling**: Improved PHP error reporting and exception handling
240272
- **Test Coverage**: Comprehensive test suite with extensive edge case coverage
241273

242-
### Known Issues
243-
244-
- Performance test may show reduced record counts on complex CSV files
245-
- Minor formatting differences in specific edge cases
246-
- Writer may not quote all fields in certain configurations
247274

248275
For the latest updates and bug reports, please check the project's issue tracker.

0 commit comments

Comments
 (0)