Git Product home page Git Product logo

Comments (2)

ircmaxell avatar ircmaxell commented on May 5, 2024

Try running the other 2 examples.

The first possibly will run slower, because it's a really trivial function, so the overhead of dispatch (calling) will be the dominant factor. See the comment in the code:

 * For very simple functions like the one we are testing here, we don't expect
 * a lot of gain (if any), since the overhead of the functional call will dominate
 * the runtime.

Instead, examples 2 and 3 do a lot more work, so should see a significantly higher gain.

from recki-ct.

jgmdev avatar jgmdev commented on May 5, 2024

The example 2 throws some error, seems like I'm missing some dependency:

php examples/02-fibo.php 
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Unknown type encountered: unknown' in recki-ct/lib/ReckiCT/Compiler/JitFu/Compiler.php:275
Stack trace:
#0 recki-ct/lib/ReckiCT/Compiler/JitFu/Compiler.php(140): ReckiCT\Compiler\JitFu\Compiler->createType('unknown')
#1 recki-ct/lib/ReckiCT/Compiler/JitFu/Compiler.php(104): ReckiCT\Compiler\JitFu\Compiler->compileInstruction(Array, Object(stdClass))
#2 [internal function]: JITFU\Func->ReckiCT\Compiler\JitFu\{closure}(Array)
#3 recki-ct/lib/ReckiCT/Compiler/JitFu/Compiler.php(108): JITFU\Func->implement(Object(Closure))
#4 recki-ct/lib/ReckiCT/Compiler/Compiler.php(32): ReckiCT\Compiler\JitFu\Compiler->convertToCallable(Array)
#5recki-ct/lib/ReckiCT/Jit.php(309): ReckiCT\Compiler\Compiler->compile('function fibo l...')
#6 recki-ct/lib/ReckiCT/Jit.php(126): ReckiCT\Jit->compileFunctionJitFu('fibo')
#7 recki-ct in recki-ct/lib/ReckiCT/Compiler/JitFu/Compiler.php on line 275

The fibonnaci sample does works, and it is a lot faster, so for numeric processing ReckiCT would shine

php examples/03-fibo-using-ir.php 
PHP completed fibo(30)==1346269 in 0.3366 seconds
ReckiCT completed fibo(30)==1346269 in 0.0098 seconds

from recki-ct.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.