Live data from Hacker News

A small but complete JavaScript engine

bellard.org

101–110 of 151 posts

Re: A small but complete JavaScript engine

#101
post #70

Earlier quoted context omitted.

> get shoved into management long before his age. Problem is that management pays so much better than a contributor of code. Society has collectively decided that management is worth more economically, than individual contributors.

Because good managers are hard to come by so you have to give some sort of incentive to attract and retain the good ones. Good managers increase the output of their team, bad ones try to make themselves look the best.

> Because good managers are hard to come by so you have to give some sort of incentive to attract and retain the good ones.

That's a nice economics just-so story. But do people think that the median manager is effective? I'd say less than half of my managers have been effective. Some of them even got promoted.

Re: A small but complete JavaScript engine

#102
post #68
post #34

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.…

One advantage of using multiple files is that you can have functions that are private to the file (static functions). So when looking at a specific file you know it can use either functions in this specific file or functions #include-d from other files. But it cannot use the private functions of other non-included files. This reduces the cognitive load and gives the compiler a way to enforce separation. In short - fi…

In Pascal you can define functions inside other functions. So if, as is often the case, the file consists of one public function that calls a number of private ones this can be enforced without needing to put them in separate files.

In newer languages like C# you can do the same. Probably works in lots of other languages too, see Rosetta Code: Nested Function:

    https://rosettacode.org/wiki/Nested_function

Re: A small but complete JavaScript engine

#103

> An online demonstration of the QuickJS engine with its mathematical extensions is available at numcalc.com. It was compiled from C to WASM/asm.js with Emscripten. Turtles all the way down!

https://www.destroyallsoftware.com/talks/the-birth-and-death...

That's one of my all-time favourite talks, but I lost the reference, and googling "JavaScript talk" is futile.

Thanks for the link, I'll be sure to bookmark it this time...

Re: A small but complete JavaScript engine

#104
post #70

Earlier quoted context omitted.

> get shoved into management long before his age. Problem is that management pays so much better than a contributor of code. Society has collectively decided that management is worth more economically, than individual contributors.

Because good managers are hard to come by so you have to give some sort of incentive to attract and retain the good ones. Good managers increase the output of their team, bad ones try to make themselves look the best.

It's not just the output of their team; compared to people like Bellard (and John Carmack, Jeff Dean, Peter Norvig, ...), 99.99% of people are mediocre. Increasing the output of 100 mediocre people by 20%-30% is worth more than contributing one person's output, even if it's 10x or 20x.

And I would argue the difference between a mediocre manager and a good manager is more than that.

Re: A small but complete JavaScript engine

#105

Earlier quoted context omitted.

> Rather than trying to figure out which of dozens of files has what you're looking for, you can just search one or two large ones. Why is this a good thing? The same amount of code and same number of results need to be scanned either way. With many files, you at least have the file name to give you some small amount of context without needing to read the code.

Working with 1 or 2 large files is vasty more productive/faster (for me) than working with 50 Seeing as Bellard is very prolific and has done more than you me and three others in a lifetime, there must be some merit to his approach.

Exactly, I think it's trading write efficiency for readability. It's good for write only projects (so mostly personal projects I'd think)

Re: A small but complete JavaScript engine

#106
post #70
post #61

Earlier quoted context omitted.

He's in his 50s keep in mind. Most people of his productivity get shoved into management long before his age. He's very good but it's not like he did ffmpeg last week and QuickJS this week. Some people are just born to be able to work all day all week, if you are one of those people please don't throw it away (I am not one of them). I think I have the knowledge to do most of his projects e.g. I have the mathematics,…

> get shoved into management long before his age. Problem is that management pays so much better than a contributor of code. Society has collectively decided that management is worth more economically, than individual contributors.

Managers are everything.. by manager I mean leaders not paperwork/monitors.

I firmly believe that 10 geniuses will go nowhere without direction 8 times out of 10. And non geniuses it will be 9.99/10. Managers were the people that turned human potential into outcomes.

Re: A small but complete JavaScript engine

#107
post #80
post #75

Earlier quoted context omitted.

> you can just search one or two large ones. if the LOC is similar in size, i don't see why having them in different files vs same file makes any difference at all. Also, your IDE should be able to navigate you to definitions and usages etc. If it doesn't, it's not a good IDE. So the problem of understanding code reduces understanding the abstract structure, not how that structure is represented on file.

Your IDE should be able to split a single file codebase into different readable modules. If it cannot do that, its not a good IDE. And slippery slope...

Do IDEs really do that type of refactoring? As a long time Emacs user I long forgot what a good IDE is capable of.

I know of automatic renaming, moving parts you select automatically to another file, but full automatic refactoring to multiple modules is something I haven’t seen.

How does this tackle circular dependencies etc. I guess the IDE must parse the code, generate the syntax tree, populate symbol tables etc. and then make the refactoring.

A side point I sometimes dream of writing an emacs module which would let me to write in a single file (for easy search and edit reasons), and then cut it into several modules where I mark them with =======xyz.h========= etc.

I also want to use this in each repo where it automatically does this. I’ll hopefuly stop procrastinating and write the thing one day :).

To end with a Game of Thrones analogy, hearing about the latest developments I sometimes feel like we editor/linux/bsd/cli users are like Wildlings beyond the wall. We live in harsher conditions, but are amazed when we see large cathedrals, castles being built inside the wall. Our life is more free but also burdensome.

Re: A small but complete JavaScript engine

#108
post #70
post #61

Earlier quoted context omitted.

He's in his 50s keep in mind. Most people of his productivity get shoved into management long before his age. He's very good but it's not like he did ffmpeg last week and QuickJS this week. Some people are just born to be able to work all day all week, if you are one of those people please don't throw it away (I am not one of them). I think I have the knowledge to do most of his projects e.g. I have the mathematics,…

> get shoved into management long before his age. Problem is that management pays so much better than a contributor of code. Society has collectively decided that management is worth more economically, than individual contributors.

It doesn't have to be that way, and indeed many orgs are moving away from that. Where I work, individual contributors who are talented and want to put in the work can attain a level comparable to a Director or Senior Director, and often even make quite a bit more money than their level-peers on the management track.

There's still a cap, of course; you can't remain an IC and have the level equivalent of a VP or C-level. The theory there is that the higher you climb the IC ladder, the more difficult it is to have increasing levels of impact without leading groups of people larger than just yourself. (And indeed, our higher-level IC positions often involve some amount of non-management leadership outside of heads-down coding all day.)

I'm not 100% sure I agree with the reasoning behind the IC ceiling, but things can be awesome for you outside of management, with plenty of career and salary growth opportunities, if you find a company that understands and values individual contribution. I wouldn't say this is a lot of companies, likely not even a majority, but it's a number that seems to be growing, at least in technical fields.

Re: A small but complete JavaScript engine

#109
post #70

Earlier quoted context omitted.

> get shoved into management long before his age. Problem is that management pays so much better than a contributor of code. Society has collectively decided that management is worth more economically, than individual contributors.

Managers are everything.. by manager I mean leaders not paperwork/monitors. I firmly believe that 10 geniuses will go nowhere without direction 8 times out of 10. And non geniuses it will be 9.99/10. Managers were the people that turned human potential into outcomes.

I would agree with you except for the legions of god-awful managers I have encountered. A good manager is a huge asset for a team, but a bad (or even mediocre) manager is often worse than having none at all.

Re: A small but complete JavaScript engine

#110
post #92

Earlier quoted context omitted.

I would have thought this was an asshole comment before I had kids. Young ones take SO much time. I don’t regret kids at all but I regret not doing even more with my time previously!

Choosing not to have kids is just a choice; it definitely doesn’t make you an asshole.

No no you misunderstand

I would have thought it was an asshole comment for implying that having kids makes you less productive. But having kids DOES make you less productive (at least when they are young) or at the very least removes great swaths of time that you would have had available otherwise, if you involve yourself with their lives at all.

Having kids or not is intensely personal and everyone has to make that decision themselves, not having them is extremely valid

Post reply on HN