Login   Register  
PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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 (3 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 313 This week: 1All time: 6,530 This week: 1,398Up
Version License PHP version Categories  
external-sort 1.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
Name: Philipp Strazny is available for providing paid consulting. Contact Philipp Strazny .
Classes: 5 packages by
Country: United States United States
Age: 47
All time rank: 1539204 in United States United States
Week rank: 447 Up46 in United States United States Up
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:313All time:6,530
 This week:1This week:1,398Up