Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carlosv2/reversestring
PHP Speed tests for reversing strings functions
https://github.com/carlosv2/reversestring
Last synced: 2 months ago
JSON representation
PHP Speed tests for reversing strings functions
- Host: GitHub
- URL: https://github.com/carlosv2/reversestring
- Owner: carlosV2
- Created: 2014-01-13T16:30:50.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-13T23:57:51.000Z (about 11 years ago)
- Last Synced: 2023-08-09T10:24:39.553Z (over 1 year ago)
- Language: PHP
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Reverse String
This project helps to test the feasibility of some reversing-string functions.
Please, note that as a requirement, the functions must not use any string or array reversal nor sort functions built into PHP (such as strrev, array_reverse, etc.). Also may not use any of the standard looping constructs (for, while, foreach...).## Running the project
To run the project just browse to the folder within the command line and execute:
$ php index.php
## Results
You will see how the algorithms are tested and the time taken per algorithm. An example result is shown:
Generate data:
1000000 strings generated.rs_divide_on_middle:
40.4279 secondsrs_stop_in_middle:
11.8895 secondsrs_stop_in_middle_with_pointer:
12.5251 secondsrs_stop_on_len_1:
23.8343 secondsrs_stop_on_len_10_by_if:
12.6121 secondsrs_stop_on_len_10_by_switch:
13.5073 secondsrs_with_arrays:
39.7664 secondsstrrev:
1.887 seconds