Ran
|
Files
197
|
Run time
–
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
\SMW\ObjectStorage, \SMW\SimpleDictionary, \SMW\ObjectDictionary Introduces a simpler implementation of a dictionary and object storage compared with the ArrayObject. \SMW\ObjectStorage Code coverage: 100% CRAP: 6 \SMW\SimpleDictionary Code coverage: 100% CRAP: 10 ## Usage $dictionary = new SimpleDictionary( array( 'Foo' => 'Bar' ) ); $dictionary->has( 'Foo' ) returns true $dictionary->get( 'Foo' ) returns 'Bar' $dictionary->set( 'Foo', array( 'Lula', 'Bar') ) $dictionary->remove( 'Foo' ) ## Runtime analysis N-Array -> Array -> $s[] = array( "name" => "Adam", "age" => 35 ); H-Array -> SimpleDictionary -> $h->set( "name", "Adam" )->set( "age", 35 ); $s[] = $h->toArray(); O-Array -> ArrayObject -> $o->offsetSet( "name", "Adam" ); $o->offsetSet( "age", 35 ); $s[] = $o->getArrayCopy(); for( $x = 0; $x < 1; $x++ ) 1) SMW\Test\SimpleDictionaryTest::testRuntimeComparison This test printed output: N-Array, Memory: 7856168 Execution time: 4.2915344238281E-5 H-Array, Memory: 7856168 Execution time: 0.00015687942504883 O-Array, Memory: 7856168 Execution time: 0.0001060962677002 for( $x = 0; $x < 100; $x++ ) 1) SMW\Test\SimpleDictionaryTest::testRuntimeComparison This test printed output: N-Array, Memory: 7859744 Execution time: 0.00049209594726562 H-Array, Memory: 7859912 Execution time: 0.0050039291381836 O-Array, Memory: 7860184 Execution time: 0.0040531158447266 for( $x = 0; $x < 10000; $x++ ) 1) SMW\Test\SimpleDictionaryTest::testRuntimeComparison This test printed output: N-Array, Memory: 11401200 Execution time: 0.054563999176025 H-Array, Memory: 11401632 Execution time: 0.56676602363586 O-Array, Memory: 11402272 Execution time: 0.41397500038147 For a large set of continues iterations, the native ArrayObject implementation has an advantage over the SimpleDictionary implementation. Change-Id: I8d8336f96
2437 of 14583 relevant lines covered (16.71%)
1.42 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|