3 ms·
Nope, Python's Tkinter canvas calls into TCL/Tk directly. It doesn't run it as a separate process. There is no comparison: Another false equivalence. (No I'm n
by DonHopkins 8y ago
Nope, Python's Tkinter canvas calls into TCL/Tk directly. It doesn't run it as a separate process. There is no comparison: Another false equivalence.
(No I'm not a matplot guy, but I've built command line plotters too and even terminal emulators that accepted escape codes with PostScript commands. ;) And I've done a lot of work with TCL/Tk and canvas both directly and through Tkinter, and also with PyGTK using pycairo, and I've integrated lots of code into Python with SWIG, including Python C extension integrated with PyCairo. Can you integrate C extensions into bash with SWIG, or any other way short or recompiling?)
Here are some open source reasons to believe me:
(search for "termulate-ps-string"):
https://www.donhopkins.com/home/code/term.ps.txt https://www.donhopkins.com/home/code/term.ps.txt
https://github.com/SimHacker/micropolis/blob/master/micropolis-activity/res/wscen.tcl https://github.com/SimHacker/micropolis/blob/master/micropol...
https://github.com/SimHacker/micropolis/blob/master/micropolis-activity/src/sim/w_tk.c https://github.com/SimHacker/micropolis/blob/master/micropol...
https://github.com/SimHacker/micropolis/tree/master/MicropolisCore/src/TileEngine https://github.com/SimHacker/micropolis/tree/master/Micropol...
https://github.com/SimHacker/micropolis/tree/master/MicropolisCore/src/pyMicropolis https://github.com/SimHacker/micropolis/tree/master/Micropol...
You keep going back to this mistaken belief that forking off separate processes is incredibly cheap. Or even convenient. You really should rid yourself of that misconception.
Sure, there is some cost to all the glue code required by something like TCL or SWIG or COM or P/Invoke or any foreign function interface. But that's not even in the ballpark of how long it takes to fork off a Unix process.
It's ironic that the strongest argument bash apologists have is that it's convenient, but once you are faced with all that mish-mashed haphazard syntax and kludgy tricks (like testing for an empty string like "x$foo" == "x"), it's actually one of the most inconvenient languages there is!
- civility 8y ago> Nope, Python's Tkinter canvas calls into TCL/Tk directly. It doesn't run it as a separate process. There is no comparison: Another false equivalence. Python's Tkinter converts all calls into strings which are parsed and executed by the hidden Tcl interpreter in there. It's really pretty hackish. I didn't say it ran in a separate process, I said it was probably on par performance-wise as bash calling gnuplot through a separate process. > Can you integrate C extensions into bash with SWIG, or any other way short or recompiling? Yuck. Why would I want to do that? I don't like SWIG or bash. SWIG generates an awful mess. When needed, I prefer to write Python extensions by hand. However, I suspect the only reason bash doesn't support plugins/extensions has more to do with some GPL ideology. > You keep going back to this mistaken belief that forking off separate processes is incredibly cheap. Or even convenient. You really should rid yourself of that misconception. You should really stick to things I've actually written. I'm starting to think you're having an argument with some imaginary bash and fork advocate in your head and pretending I'm him.
- DonHopkins 8y agoNo it's not on par with bash calling gnu plot as a separate process, because bash and gnuplot ALSO have to convert back and forth between text and binary floating point numbers, and more importantly, as I keep repeating and you refuse to acknowledge, the cost of forking a Unix process is way more expensive than converting between text and binary strings. Not comparable. False equivalence. And then on top of that, you still have to convert just as many numbers and strings back and forth -- if not more! It's not just the calling and conversion overhead of gnuplot: bash also has to fork off many more "bc" processes that themselves convert text numbers to binary, evaluate expression, then convert binary numbers back to text (and there could be hundreds or thousands of expressions). While Python with pycairo can draw a pie chart without once converting numbers between text and binary, reading and writing text to a pipe, context switching, or forking off thousands of processes. The only thing I was imagining about you was that you were listening to what I was saying, but I keep finding I need to repeat myself.
- civility 8y ago> I keep finding I need to repeat myself Communicating with people is hard, especially when you only really want to repeat yourself and not try to understand what anyone else is saying. I get your point - fork is slow. Now what do you think my point was? Please don't bother repeating yourself again.
- civility 8y agoUgh, you edited a bunch while I was replying again. I can't keep up. My only point had been that Python is also slow.
- DonHopkins 8y agoBut nowhere near as slow as forking separate processes. The subject of this discussion.
- pdkl95 8y ago> Can you integrate C extensions into bash with SWIG, or any other way short or recompiling? Yes[1], although I don't recommend doing that. See my longer comment[2] re: bash is a simple scripting/glue language, not a general-purpose programming tool. [1] https://github.com/taviso/ctypes.sh https://github.com/taviso/ctypes.sh [2] https://news.ycombinator.com/item?id=19951990 https://news.ycombinator.com/item?id=19951990