Skip to content

Commit

Permalink
Added Travis badge and benchmarks
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
jasny committed May 21, 2018
1 parent ddeff53 commit a125972
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Base58 PHP extension

[![Build Status](https://travis-ci.org/legalthings/base58-php-ext.svg?branch=master)](https://travis-ci.org/legalthings/base58-php-ext)

PHP extension for base58 encoding and decoding using the Bitcoin alphabet.

Using this extension is an order of magnitude faster than using userspace functions.
Using this extension is about 100 times faster than using userspace functions.

## Requirements

Expand Down Expand Up @@ -47,3 +49,45 @@ To encode a hash, make sure you're using the raw hash and not a hexidecimal stri
$rawHash = hash('sha256', 'some string', true); // The `true` makes the function return a raw hash
$encodedHash = base58_encode($rawHash);


## Benchmark

The extension is run in test `Base58ExtEvent`. The `Base58BCMathEvent` and `Base58GMPEvent` tests use
the `StephenHill\Base58` PHP library.

```
StephenHill\Benchmarks\Base16Event
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase16: [10,000 ] [0.0000001919985] [5,208,374.51881]
decodeBase16: [10,000 ] [0.0000004031897] [2,480,222.34049]
StephenHill\Benchmarks\Base58BCMathEvent
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase58: [10,000 ] [0.0000484058857] [20,658.64482]
decodeBase58: [10,000 ] [0.0000523419857] [19,105.12157]
StephenHill\Benchmarks\Base58ExtEvent
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase58: [10,000 ] [0.0000003235340] [3,090,865.14370]
decodeBase58: [10,000 ] [0.0000003539085] [2,825,588.79008]
StephenHill\Benchmarks\Base58GMPEvent
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase58: [10,000 ] [0.0000255326509] [39,165.53757]
decodeBase58: [10,000 ] [0.0000418104410] [23,917.47075]
StephenHill\Benchmarks\Base64Event
Method Name Iterations Average Time Ops/second
------------ ------------ -------------- -------------
encodeBase64: [10,000 ] [0.0000003066778] [3,260,750.99122]
decodeBase64: [10,000 ] [0.0000003187656] [3,137,100.97233]
```

0 comments on commit a125972

Please sign in to comment.