3 ms·
Embedding Scheme in Rust
- oldpersonintx 2y ago[dead]
- anonzzzies 2y agoLong ago, I decided to embed a scheme in C++ when I was building a game (nothing AAA or fancy; just a RPG mixed with shmup I wanted to make since I was a kid); when I succeeded, I noticed I never touched the C++ again. So then wondered why I used C++ in the first place and went full for Chezscheme, which is very fast anyway and fast enough for most things. It is fun though. I found the Python case a better fit; it was (is) so slow that actually it makes sense to implement critical path code in C/++.
- mrkeen 2y agoI did something similar. C++ game engine with embedded Lua. I brought it to a C++ job interview. The interviewer kept asking how certain things worked. After a while I realised I was only clicking into Lua source code to show what was going on. He said something like, "You know you can just write C++, right?" Did not get the job :)
- Permik 2y agoHopefully the interviewer did not cut you out because of the project, because there's many valid reasons why someone would use Lua: - "no need to use C++ for non-performance critical sections of job." - "The nature of the game does not require high levels of optimizations to implement the game" - "This is just the MVP, lua lets me iterate more quickly" (totally lying, you're totally going to ship the game as is) i.e. "why many word when few do job"
- paines 2y agoIntresting. I know of two projects from the past where people used Gambit and Chicken and couldn't recommend it, because of the garbage collection. So the games runs, bullets fly, monsters move, etc... and at some point gc kicks in and you would notice a minimal halt or lag which for games is a big NO NO. Now that you mentioned a shmup, where a lot I going on, I am wondering how you or Chez handled that?
- shakna 2y agoChez's GC is a lot more configurable, and the default is smarter, than either Gambit or Chicken. Chez has a generational garbage collector, rather than the more simple ones. It can also run in parallel mode, to prevent it being "stop the world" - it'll run in another thread instead. Because the collections are smaller, and you can slightly offload them into another thread, it's a lot less noticeable in usage.
- stefanka 2y agoHow does this compare to steel? https://github.com/mattwparas/steel https://github.com/mattwparas/steel
- raviqqe 2y agoStak aims to add a scripting environment in Rust with minimal overhead (e.g. additional bin size) but a slight sacrifice of speed. For example, its VM is written in ~1500 lines in Rust including some tests (https://github.com/raviqqe/stak/tree/f799140377162f1c2f94cc4bb4ca246284aad641/vm/src https://github.com/raviqqe/stak/tree/f799140377162f1c2f94cc4....) The philosophy is similar to SectorLisp (https://github.com/jart/sectorlisp https://github.com/jart/sectorlisp) but for R7RS :)
- stefanka 2y agoInteresting, thanks. Do you plan speed/performance comparisons as a scripting / pluign language? That would be relevant for games or graphics intense usecases—blackjack-rs considered scheme/lisp but opted for mlua due to performance)
- raviqqe 2y agoHere are some benchmarks: https://github.com/raviqqe/stak/actions/runs/12654408322/job/35262219826 https://github.com/raviqqe/stak/actions/runs/12654408322/job... For pure computational work, Stak is 2 to 2.5 slower than CPython. These are E2E benchmarks for the interpreter commands. As you said, I should probably add benchmarks of scripting use cases with Lua.
- stefanka 2y agoThat's very promising! It might be benefitial adding these to the front page. I will keep an eye on the project, thanks
- deleted 2y ago[deleted]
- unit149 2y ago[dead]
- deleted 2y ago[deleted]