3 ms·
> Powershell does the UNIX philosophy better than the equivalent traditional toolset How so? Remember that the "text" convention was not chosen haphazardly, b
by mpweiher 9y ago
> Powershell does the UNIX philosophy better than the equivalent traditional toolset
How so? Remember that the "text" convention was not chosen haphazardly, but rather very consciously.
- wvenable 9y agoThe convention was chosen back when both CPU and memory were also many orders of magnitude less. Also chosen back when many principles of good software design were still in their infancy. Decisions made 40 years ago were based on entirely different constraints and with a lot less history.
- bitwize 9y agoAnd it's wrong. Nearly everything taught to you by Unix is wrong. The textual format convention is wrong because text needs to be parsed and unparsed, which is slow and error-prone. Moving objects with clearly defined APIs between programs is more performant and robust. To move objects between machines, use a binary format like Cap'n Proto, which requires no parsing. The only thing text gives you is viewability/editability with vi or nano; with a well-defined, open binary format, tools can be easily written to view and manipulate the raw data streams. Unix's I/O model is broken because it has no intrinsic support for asynchronous I/O. The POSIX aio API sucks, nobody uses it, and it doesn't allow the single syscall check-for-data-and-kickoff-overlapped-I/O-if-not-found that's practically an idiom in Windows (at least not under Linux, where it's implemented in user space via helper processes). The standard multiprocessing primitives in Unix are broken. fork() starts a new process with the same memory image, possessing the same system resources as the old -- convenient in 1979 but highly dangerous in the presence of threads. The correct approach would be to specify a new image to load and run, as in posix_spawn or Windows CreateProcess. In short, fuck Unix and fuck the Unix Philosophy.
- mpweiher 9y ago> slow and error-prone And yet in all my tests Unix was at least an order of magnitude faster than PowerShell. Considering the data doesn't back you, I'd watch my proclamations.
- justinsaccount 9y agoA specific implementation not being particularly optimized does not mean the underlying concept is flawed.
- josefx 9y agoThe claim was that text based tools are slower, right now that is clearly not the case. Of course a comparison between the current implementation of powershell and unix tools is not quite fair, they only had twelve years after all and unix had ~fourty. I would give them annother three decades to catch up.
- mhermher 9y agoCompiled code generally runs faster than plain-text interpreted code, even with no compiler optimizations. How about those tools? The whole point was that text parsing is an additional overhead that will make things slower. It's trivially true.
- flukus 9y agoHow does powershell pass objects from one process to another? Presumably there's a serialization/deserialization step involved? This could easily be slower than copying test around.
- mhermher 9y agoThere doesn't have to be. It could just pass references to memory addresses of the object, or even just a copy of the raw binary data. If both the passer and the receiver understand the class of the object, then there is no serialization/deserialization necessary.
- flukus 9y ago> It could just pass references to memory addresses of the object How? They're different processes running in different threads. If it's raw binary data then it has to at least be copied, which will often be a lot less efficient than just copying text. You can't just memcpy complex .net objects though. There's nothing stopping unix programs from piping raw binary data, it's just not generally done because it's usually a bad idea.
- Aloha 9y agoWhy is binary better? With binary you need to worry about versioning, you need to worry about API support, you cant as easily verify the contents of what you're passing around - in general the industry has moved away from binary everything towards text based file formats (containerized like OOXML, or ODF), text based signalling (SIP, and XMPP) - I can go on. While I think binary blobs have a place, I dont think they're a panacea to solve problems - I consider them an anti-pattern because they make the humans trying to troubleshoot when things go wrong much harder.
- justinsaccount 9y agoIf the text format was chosen responsibly most unix utilities could output data in a machine readable TSV mode with a standardized header and escaping format, not the mess we have now.