Currently composed of 85,624 lines of C code, mostly in quickjs.c (53,575 lines in that one file alone), but also with a couple other large ones. I can't say I understand the reason for such massive files. Surely it would be easier to maintain if it was split into a few well-defined modules? In addition to the maintenance concerns, a JavaScript engine has quite a few parts that could be used as individual components.…
A small but complete JavaScript engine
41–50 of 151 posts
Re: A small but complete JavaScript engine
#42Earlier quoted context omitted.
Agreed. 10 years ago, I could still pretend I'd be able to come close to his productivity if I "just set my mind to it." Today (being older, slower, and having a family), I can only be humble.
I’m really starting to feel the age and competing priorities with family. Makes me really scared about ageism.
Re: A small but complete JavaScript engine
#43Earlier quoted context omitted.
Serious question, why is this a joke? Couldn't javascript be just another language to replace bash?
People typically write small, short scripts in bash, not web applications. The same goes for JavaScript, but in reverse. They were designed for different things.
Re: A small but complete JavaScript engine
#44Earlier quoted context omitted.
I’m really starting to feel the age and competing priorities with family. Makes me really scared about ageism.
Maybe but as the kids get older you the time back and your more efficient with it as a result of those early years... I think at least I’m faster and smarter now then ten years ago... maybe I’m losing my eye sight and my hearing or maybe it’s true :)
Re: A small but complete JavaScript engine
#45Bellard is actually a genius, right? What's his secret? The project list at bellard.org is impressive.
Re: A small but complete JavaScript engine
#46Currently composed of 85,624 lines of C code, mostly in quickjs.c (53,575 lines in that one file alone), but also with a couple other large ones. I can't say I understand the reason for such massive files. Surely it would be easier to maintain if it was split into a few well-defined modules? In addition to the maintenance concerns, a JavaScript engine has quite a few parts that could be used as individual components.…
Re: A small but complete JavaScript engine
#47Currently composed of 85,624 lines of C code, mostly in quickjs.c (53,575 lines in that one file alone), but also with a couple other large ones. I can't say I understand the reason for such massive files. Surely it would be easier to maintain if it was split into a few well-defined modules? In addition to the maintenance concerns, a JavaScript engine has quite a few parts that could be used as individual components.…
I think the main benefit of single file is that it will be easier to used in other projects, but this is just my assumption.
Re: A small but complete JavaScript engine
#48Turtles all the way down!
Re: A small but complete JavaScript engine
#49> Can compile Javascript sources to executables with no external dependency. Is QuickJS a viable way to write command-line apps in JavaScript? In particular, does it have enough of a standard library to work with, or would it be a struggle because (I assume) it can’t use packages from NPM? I know there’s the alternative of bundling Node.js and V8 into an executable, but the resulting binaries are large - it feels lik…
It has a very small standard library: https://bellard.org/quickjs/quickjs.html#std-module It would be enough for a good number of CLI tools, I'd think. But one big issue is going to be that every library on NPM is hardcoded to use Node's modules (e.g. fs) so you're not going to be able to use any external modules at all.
Here's one example: https://www.npmjs.com/package/squat
Re: A small but complete JavaScript engine
#50QuickJS is a really, really interesting engine because it's only ~200KB. Fits a lot of cases where you want to add scripting ability but without bulking out size unnecessarily. Unfortunately because it lacks stuff like JIT it'll never rival the likes of V8 in performance. But in terms of bang for buck it's unbeatable.