2017 © Pedro Peláez
 

library string-array

image

ale/string-array

  • Wednesday, April 13, 2016
  • by alanevans
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

string-array

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version Total Downloads License, (*1)

This is an experimental library that intends to provide access to a C-like array within PHP. I cannot say whether this is a good idea or not, it mainly depends on your use case., (*2)

The current implementation uses a PHP string to avoid the memory overhead of using PHP's native hash table of Zvals to implement an array of arrays. This sacrifices speed for memory., (*3)

For even more (and slower) memory, you could consider shifting parts of the string off into files., (*4)

As an informal example, a 10000x1000 StringArray (10,000,000 data cells) takes about 40MB and takes about 10s to populate on an ok-ish laptop. The same in nested PHP arrays can be done in about half the time, but takes 1.4GB. I can easily test a StringArray of 10000x10000, which takes about 400MB, but it becomes prohibitive to test that size of array with native PHP arrays., (*5)

The question might well be "what possible use case requires that much memory but can afford to take that much time?" Well, I leave that up to you., (*6)

Installation

string-array can be installed with Composer by adding it as a dependency to your project's composer.json file., (*7)

{
    "require": {
        "ale/string-array": "*"
    }
}

Please refer to Composer's documentation for more detailed installation and usage instructions., (*8)

Usage

@todo, (*9)

TODO

I'm not sure when any of these will get done., (*10)

  • Testing
  • Currently, only 32-bit ints are handled. More types should be possible, chars would be super easy.

The Versions