Make WordPress Core

Ticket #16684: performance.php

File performance.php, 1.1 KB (added by ryan, 16 years ago)

Quick microtime perfomance test

Line 
1<?php
2
3function perf_texturize() {
4 wptexturize('Hey -- boo?');
5 wptexturize('<a href="http://xx--xx">Hey -- boo?</a>');
6 wptexturize('<pre>---</pre>');
7 wptexturize('[a]a--b[code]---[/code]a--b[/a]');
8 wptexturize('<pre><code></code>--</pre>');
9 wptexturize('<code>---</code>');
10 wptexturize('<code>href="baba"</code> "baba"');
11 wptexturize('<code>curl -s <a href="http://x/">baba</a> | grep sfive | cut -d "\"" -f 10 &gt; topmp3.txt</code>');
12 wptexturize('<pre>"baba"<code>"baba"<pre></pre></code>"baba"</pre>');
13 wptexturize('("test")');
14 wptexturize("('test')");
15 wptexturize("('twas)");
16 wptexturize('A dog ("Hubertus") was sent out.');
17 wptexturize('Here is "<a href="http://example.com">a test with a link</a>"');
18 wptexturize("'<strong>Quoted Text</strong>',");
19 wptexturize('&nbsp;"Testing"');
20}
21
22function perf_run() {
23 if ( ! isset($_GET['perf']) )
24 return;
25
26 if ( ! function_exists('perf_' . $_GET['perf']) )
27 return;
28
29 $repeat = !empty( $_GET['repeat'] ) ? (int) $_GET['repeat'] : 1;
30
31 timer_start();
32
33 for ( $i = 0; $i < $repeat; $i++ ) {
34 call_user_func('perf_' . $_GET['perf']);
35 }
36
37 timer_stop(1);
38
39 exit;
40}
41add_action('init', 'perf_run');