PHP Classes
elePHPant
Icontem

External Sort: Sort large files similar to the UNIX sort command

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2011-11-05 (4 years ago) RSS 2.0 feedNot enough user ratingsTotal: 345 This week: 3All time: 6,654 This week: 377Up
Version License PHP version Categories
external-sort 1.0.0Freely Distributable5Algorithms, PHP 5, Text processing, C...
Description Author

This class can sort large files similar to the UNIX sort command.

It can read the file to be sorted in small buckets associated to temporary files to not exceed the configured PHP memory limits.

The buckets are sorted individually and then merged to produce the final sorted output.

The class provides command line interface options so it can be executed as a command from a shell.

Innovation Award
PHP Programming Innovation award nominee
November 2011
Number 7
Sorting data is a relatively easy operation to implement in PHP using the many variants of PHP array sorting functions.

However, if you need to sort large amounts of data, that is not very easy, as it may exceed PHP configured memory limits.

This class implements an approach to sort large files similar to the Unix sort command.

It splits a file to be sorted in multiple chunks of limited size and then merges the sorted results into a final output file.

Manuel Lemos
Picture of Philipp Strazny
  Performance   Level  
Name: Philipp Strazny <contact>
Classes: 5 packages by
Country: United States United States
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Screenshots  
  • efficiency_comparison.png
  Files folder image Files  
File Role Description
Plain text file ExternalSort.php Class the external sorting application
Accessible without login HTML file ExternalSort_about.htm Doc. explanations, examples, performance
Accessible without login Plain text file BucketCollectionTest.php Test unit tests for BucketCollection utility class
Accessible without login Plain text file ExternalSortTest.php Test unit tests for ExternalSort
Accessible without login Plain text file License Lic. Academic Free License

 Version Control Unique User Downloads Download Rankings  
 0%
Total:345
This week:3
All time:6,654
This week:377Up