Benchmark #8
Unanswered
AlixANNERAUD
asked this question in
Q&A
Replies: 2 comments 1 reply
-
No interpreted language will ever come within a few orders of magnitude of
compiled, If you can compile code (and I include JIT languages) then that
will always be the fastest and preferable solution.
Compilation is not possible for many use cases. JIT compilation is not
allowed on consoles (xbox/ps) for example since there are strict hardware
controls on execution space for security reasons, but many projects call
for code written by users. In my example I want users to write their own
lightning scripts. Trivial, but I need them to execute on embedded hardware
and requiring installation and compilation of the entire tool stack for the
chip (and the associated hardware required to reprogram it in the field?)
not an option.
So I needed an interpreter that could run on extremely limited hardware
(oh, and 8 of them simultaneously, one for each channel) yet be fast enough
to maintain 60 updates/sec with somewhat mathy/arbitrary code? Didn't exist
so I made wrench.
I chose c semantics so the language would be easy to learn and "just work"
for the most programmers possible. The secret sauce is the compiler that
breaks it down into byte code before execution, it's not directly
interpreted. I observed it executing a wide-range of tasks and added
several "super instructions" that do many tasks in a single byte-code
cycle, for example:
if ( x < y ) { } else { }
Is a single instruction
The code itself is implemented with jump-tables wherever possible and
profiled heavily to knock down any unexpected tall poles.
To paraphrase one my my heroes Michael Abrash: Until the wrench interpreter
is a single nop there will always be more cycles to find, but I think I've
done a pretty good job of optimizing for now. It's much faster than lua,
squirrel and way faster than Python ... If I need more speed I'll come back
to it, and if someone else wants to take a crack at it, well that's why I
published it for everyone to wrench on. (see what i did there? :)
…-Curt
On Thu, Apr 6, 2023 at 2:50 AM Alix ANNERAUD ***@***.***> wrote:
Thank you for your awesome project. The benchmark published looks
promising, but your scripting language looks like many others, how do you
manage to make it faster than others (Lua for example) ?
And do you have other benchmarks comparison (for example : Berry-Lang,
Toit or regular C/C++ compiled code) ?
—
Reply to this email directly, view it on GitHub
<#8>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALIKAZPIQACZSCANYMQWM3W7ZRR7ANCNFSM6AAAAAAWU72AKE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I'd love to answer that question but I'm afraid I don't understand it, what
do you mean by "classes"?
…On Fri, Apr 7, 2023 at 10:14 AM Alix ANNERAUD ***@***.***> wrote:
Okay, thank you for your answer. Indeed, it makes sense. In any case it is
a great project with impressive efficiency. I did some tests and it turned
out that on my laptop (i5 10th gen), wrench passed the benchmark in 17
seconds, against 30 seconds for berry and 47 for wren. However, I still
have a question, do you intend to implement the classes?
—
Reply to this email directly, view it on GitHub
<#8 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALIKA4KALDBU7FNEIJY3FTXAAOLVANCNFSM6AAAAAAWU72AKE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thank you for your awesome project. The benchmark published looks promising, but your scripting language looks like many others, how do you manage to make it faster than others (Lua for example) ?
And do you have other benchmarks comparison (for example : Berry-Lang, Toit or regular C/C++ compiled code) ?
Beta Was this translation helpful? Give feedback.
All reactions