3 ms·
> Programming is hard, regardless. You're being very dismissive towards shell scripters, and it comes off as elitist. I think you're taking this too personally
by jacobparker 9y ago
> Programming is hard, regardless. You're being very dismissive towards shell scripters, and it comes off as elitist.
I think you're taking this too personally. I write _a lot_ of bash scripts and like bash (as I've already indicated.) It's not always the right tool for the right job (no tool is...)
> What do you mean by parsing? Copying, reading? The buffers sit in kernel memory, sure… but that's pretty fast if every line in your program is concurrent.
The buffers don't just sit in the kernel, they are copied between processes (via write/read.) This involves many many context switches. By contrast (but this is just an example), libgit2 will hopefully mmap your packfiles, and once the data is mapped in you don't have to leave your process.
Parsing is sometimes obvious, for example multiple passes over the data with grep and sed to shape it the way you want. It's true that components of the pipeline can run in parallel but the problem is they do a lot of unnecessary work - parallelizing unnecessary work doesn't remove it and once you hit the limit of # of cores (which is very relevant when generating HTML - something often done by webservers with many concurrent requests where you don't have cores to spare on parallelizing inefficient algorithms.)
Parsing is sometime not as obvious, for example steps in the pipeline doing redundant Unicode validation. This is an artifact of squeezing things through read/write with reusable components. It's convenient (which makes it great for prototyping, or for things that "don't matter") but this adds up to poor performance.
> Did you have a bad experience with xargs?
> Did you have a bad experience with… running out of… PIDs?
I think you're being very uncivil. xargs is useful but it (with the common options like -n and -P) can spawn many processes which has a tremendous overhead vs an alternative like a function call. It's purely a performance thing.
(I probably should be using parallel but I'm used to xargs :( )
- falsedan 9y ago> I think you're being very uncivil. I'm sorry. I see how my questions come off as questioning your experience, and I didn't mean to do that. > I think you're taking this too personally. I think your reluctance to admit that you needlessly insulted some class of devs is exclusionary. Casual readers of these comments may think it's bad to write bash, or that it's ok to bash people who do. > The buffers don't just sit in the kernel, they are copied between processes (via write/read.) Yes, that's right. I know how pipes work, thanks. What you call 'parsing' I would call processing. Parsing has a well-defined meaning in the context of computer science: turning tokens into a data structure (like a syntax tree). > parallelizing unnecessary work doesn't remove it Is unnecessary work a problem? If you're being charged by the second, perhaps it may be cost-effective to eliminate it… but most of the time, developer productivity is a bigger cost. I see that you are mindful of the performance implication of your code. I usually have to think of developer throughput, so I'm very tolerant of inefficient use of hardware if it means someone gets their job done faster.
- hnbroseph 9y ago> class of devs wait... what? is this marxist class struggle framing? there is no 'class of devs' in this sense. there is no 'social justice' here. bash is not a person, bash is not an identity, none of this applies.
- falsedan 9y agoClass in the OO/taxonomy sense. I feel like you are projecting some of your existing issues onto this discussion.
- hnbroseph 9y agoit's more related to the nature of your wording and framing. no group of humans is being abused or discriminated against.
- falsedan 9y agoThen I should have said, type of developer. I see how 'class' has weighty connotations. > * no group of humans is being abused or discriminated against* I disagree, you make it abundantly clear that 'real' tools cannot be written in bash, and that people who write in bash are not producing as high-quality work as those who use other languages (like python).