Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Improvements and New Features in Forked Version #109

Open
zao111222333 opened this issue Jun 26, 2024 · 2 comments
Open

Performance Improvements and New Features in Forked Version #109

zao111222333 opened this issue Jun 26, 2024 · 2 comments

Comments

@zao111222333
Copy link

Hey,

Thank you for creating this awesome work!

I’ve made some improvements while using this crate and wanted to share my fork. I would be delighted if some of my changes could be merged into this repo.

Some noticeable features include:

  • WASM runtime support: Try it out in the demo.
  • Static command registration using macros: I introduced gen_command! and gen_subcommand! macros to statically register commands during compilation, utilizing match blocks for command/subcommand token matching instead of indexing by HashMap. This optimization enhances performance since native and embedded commands should remain unchanged at runtime.
  • Generic context support: Replaced ContextMap with a user-defined generic Ctx (the definition of Interpreter is now Interp<Ctx>), allowing direct access to the Interpreter’s context via interp.context.
  • Multi-line command support in interactive terminal: Added support for incomplete mode when typing multi-line commands (e.g., if, for, …). You can try it in the demo.

Lastly, I evaluated the forked version against molt 0.3.2. Here are the results (note that performance is influenced by real-time CPU workload, and the values represent general cases):

  • Command: cd molt-app && cargo run --release bench ../benchmarks/basic.tcl

  • Platform: Intel Xeon 6348 CPU

molt-forked 0.4.0 (time unit in Nanos) molt 0.3.2 Speedup (×) Benchmark
89 208 2.34 ok-1.1 ok, no arguments
90 207 2.3 ok-1.2 ok, one argument
97 219 2.26 ok-1.3 ok, two arguments
119 209 1.76 ident-1.1 ident, simple argument
209 402 1.92 incr-1.1 incr a
158 311 1.97 set-1.1 set var value
201 348 1.73 list-1.1 list of six items

Thank you for considering these changes! If could, I will organize the changes and make PR.

@wduquette
Copy link
Owner

Thank you for your hard work! I am no longer working on Molt, and have not since, I think, 2020. The license is BSD; if you would like to continue development of your own fork, you have my blessing.

@zao111222333
Copy link
Author

Thank you for your hard work! I am no longer working on Molt, and have not since, I think, 2020. The license is BSD; if you would like to continue development of your own fork, you have my blessing.

Thank you again for your support and creating such a solid foundation with Molt!
If you ever decide to return or have any suggestions, I’d be delighted to hear from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants