Skip to content

Instantly share code, notes, and snippets.

@Spomky
Created January 22, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spomky/477b10577c3dae32968b to your computer and use it in GitHub Desktop.
Save Spomky/477b10577c3dae32968b to your computer and use it in GitHub Desktop.
<?php
require_once("vendor/autoload.php");
use Base64Url\Base64Url;
use MIME\Base64URLSafe;
$test = "Hello world";
$time_start = microtime(true);
for ($i=0; $i < 65536; $i++) {
Base64URLSafe::urlsafe_b64decode(Base64URLSafe::urlsafe_b64encode($test));
}
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "yowcow/mime-base64-urlsafe: $time seconds\n";
$time_start = microtime(true);
for ($i=0; $i < 65536; $i++) {
Base64Url::decode(Base64Url::encode($test));
}
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "spomky-labs/base64url: $time seconds\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment