Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Make the examples actually run 100,000 times.#2

Open
huanga wants to merge 1 commit intogoogle:masterfrom
huanga:master
Open

Make the examples actually run 100,000 times.#2
huanga wants to merge 1 commit intogoogle:masterfrom
huanga:master

Conversation

@huanga
Copy link
Copy Markdown

@huanga huanga commented Aug 29, 2014

This is a simple fix, I release all rights to the modification. If you'd still need a CLA, please let me know and I'll file one. Filed electronically :)

@huanga
Copy link
Copy Markdown
Author

huanga commented Aug 29, 2014

Memo: This actually makes it take really really really long to complete. I'm not sure if it is a great idea, now that testing it some more. Perhaps the right action here is the revise the comment and make it loop some more reasonable amount.

@ircmaxell
Copy link
Copy Markdown
Contributor

I definitely think making them run multiple times is a good idea. 100k may be a bit much.

The target I used for benchmarks was 1 second. So perhaps try getting the PHP implementation to take 1 second, and then put that number of iterations in the example.

Thanks!

@huanga
Copy link
Copy Markdown
Author

huanga commented Aug 29, 2014

I found that fibo(30) on my desktop (i7-3770, 16G ram, PHP 5.5.15-1+deb.sury.org~precise+1 (cli) (built: Jul 24 2014 15:44:50)) taking around 0.3 second to complete.
This means the desired benchmark would need 3 iterations, but that seems kind of silly. I've reduced it to fibo(20) instead, which is significantly less intensive, and iterate 500 times to hit around 1.2 seconds. However, I'm not seeing much benefit from Recki-Ct:

andy@BBTV-Andy:~/temp/recki-ct/examples$ php 02-fibo.php 
PHP completed fibo(20)==10946 in 1.1802 seconds
ReckiCT completed fibo(20)==10946 in 1.1869 seconds
andy@BBTV-Andy:~/temp/recki-ct/examples$ php 03-fibo-using-ir.php 
PHP completed fibo(20)==10946 in 1.1978 seconds
ReckiCT completed fibo(20)==10946 in 1.2045 seconds

I wonder if I have an oddly configured PHP that is not behaving correctly to leverage the optimizations?

@ircmaxell
Copy link
Copy Markdown
Contributor

You're not seeing the optimizations because you don't have the jitfu extension installed, so you're just executing the fallback PHP code...

@staabm
Copy link
Copy Markdown

staabm commented Aug 30, 2014

Should it emit a warning when jitfu ext is missing? Or should it be required(-dev) in composer.json?

@ircmaxell
Copy link
Copy Markdown
Contributor

No, because more backends then just JitFU are planned on being supported. In fact, there is a PHP backend today that'll generate PHP code back out of it. And I'd like to see others (a virtual machine backend, then perhaps an LLVM backend, etc). JitFU is a requirement for the final compilation today. But not for using the tool.

Which is why it's called "Compiler Toolkit". It's not a single compiler with a single target. It's a set of tools to target arbitrary backends.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants