Threads for chadski

  1. 2

    Dumb question; but why can’t we do something about GIL if it hurts parallelism? Maybe option to remove/disable it? I think it must’ve been done somewhere.

    1. 14

      One reason it is hard technologically is because at the moment: any operation that involves only a single Python bytecode op, OR any call into a C extension which doesn’t release the GIL or re-enter the Python interpreter, is atomic. (Re-entering the Python interpreter may release the GIL.)

      This means all kinds of things are atomic operations in Python. Like dict reads/writes and list.append(), either of which may call malloc or realloc in the middle.

      You can write many data race-y programs in Python that have well-defined (messy, but still well defined) semantics. I think nobody in the world has an idea of how much code there might be in the wild that (possibly accidentally) abuses this. So making data races be undefined behaviour would be quite a large backwards compatibility break, in my opinion.

      You don’t want to “just” slap a mutex on every object because then the lock/unlock calls world kill performance.

      I believe the PyPy developers are/were looking at shipping an STM implementation and the GILectomy fork involves a lot of cleverness of which I can remember no details.

      1. 6

        There have been (more than) a few experiments to remove the GIL in the past 20 years. To my knowledge they end up performing worse or being less safe.

        There’s a new PEP to get a more granular GIL.

        1. 11

          There is an exciting new approach by Sam Gross (https://github.com/colesbury) who has made an extremely good NOGIL version of Python 3.9 (https://github.com/colesbury/nogil) It performs almost without any overhead on my 24 core MacPro test machine.

          It is a sensational piece of work, especially as you mentions there have been so many other experiments. I know Sam has been approached by ThePSF. I am crossing my fingers and hope they will merge his code.

          1. 9

            I’ve been struggling with a Python performance issue today that I suspected might relate to the GIL.

            Your comment here inspired me to try running my code against that nogil fork… and it worked! It fixed my problem! I’m stunned at how far along it is.

            Details here: https://simonwillison.net/2022/Apr/29/nogil/

          2. 6

            They tend to perform worse on single threaded workloads. Probably not all, but I’m quite sure that several attempts, even rather naive ones, produced multi-threaded speed ups, but at the cost of being slower when running on a single thread.

            Even ideas that succeeded to improve multi thread performance got shot down because the core team believes this (slower single core for fast multi core) is not an acceptable trade off

            1. 4

              IIRC the position was taken fairly early on by Guido that proposals to remove the GIL would not be accepted if they imposed slowdowns on single threaded Python on the order of… i think a cutoff of about 5% or 10% might have been suggested?

              1. 1

                That’s kind of what I remember too.

          3. 4

            There are experiments underway, e.g. https://lukasz.langa.pl/5d044f91-49c1-4170-aed1-62b6763e6ad0/, and there have been previous attempts that failed.

            1. 3

              Because alegedly, the gain in safety is greater than that of efficiency of concurrency.

              It is a reliable, albeit heavy handed, way of ensuring simple threaded code generally works without headaches. But yes, it does so by eroding the gains of multithreading to the point of questioning if it should exist at all. Arguably.

              Some async libraries mimic the threading API while resoursing to lower level async primitives. Eventlet and gevent come to mind.

              1. 2

                No, it’s about performance and a little bit about compatibility.

                Most Python programs are single-threaded, and removing the GIL would not cause most of those to want to become multi-threaded, since their average Python program’s workload is not something that benefits from being multi-threaded. And basically every GIL removal attempt has caused performance regression for single-threaded Python programs. This has been declared unacceptable.

                Secondarily, there would be a compatibility issue for things which relied on the GIL and can’t handle having the acquire/release turned into no-ops, but the performance issue is the big one.

                1. 2

                  And basically every GIL removal attempt has caused performance regression for single-threaded Python programs. This has been declared unacceptable.

                  Why does this happen?

                  1. 5

                    Most of the time when a GIL removal slows down single-threaded code, it’s because of the GC. Right now Python has a reference-counting GC that relies on the GIL to make incref/decref effectively atomic. Without a GIL they would have to be replaced by more cumbersome actually-atomic operations, and those operations would have to be used all the time, even in single-threaded programs.

                    Swapping for another form of GC is also difficult because of the amount of existing extension code in C that already is built for the current reference-counting Python GC.

              2. 2

                Because significant portions of the Python ecosystem are built with a GIL in mind, and would probably break the moment that GIL is removed. You’d essentially end up with another case of Python 2 vs Python 3, except now it’s a lot more difficult to change/debug everything.

                1. 2

                  A heavy-handed approach is to use multiprocessing instead of multithreading. Then each subprocess gets its own independent GIL, although that creates a new problem of communicating across process boundaries.

                1. 20

                  After I learned about “ci” in vim I got hooked. All of the sudden replacing text in quotes became as simple as ci” and now I’m having a hard time to use other editors. Sometimes a little detail is all that it takes.

                  1. 8

                    This was extremely helpful thanks.

                    Just to clarify to others. In vim if you are on a word “c” starts a change and the next keystroke determines what will be changed. For example, “c$” removes text from where the cursor is to the end of the line.

                    Now what is new for me is vim has a concept of “inner text”. Such as things in quotes, or inbetween any two symmetric symbols. The text between those two things are the “inner text”.

                    For example, in this line, we want to change the “tag stuff” to “anything”.

                    <tag style="tag stuff">Stuff</tag>
                    

                    Move the cursor anywhere between the quotes and type ci then a quote and you are left with

                    <tag style="">Stuff</tag>
                    
                    1. 8

                      This is a good example of why to me learning vi is not worth the trouble. In my normal editor, which does things the normal way, and does not have weird modes that require pressing a key before you are allowed to start typing and about which there are no memes for how saving and quitting is hard, I would remove the stuff in the quotes by doing cmd-shift-space backspace. Yes, that technically is twice as many key presses as Vi. No, there is no circumstance where that would matter. Pretty much every neat Vi trick I see online is like “oh if you do xvC14; it will remove all characters up to the semicolon” and then I say, it takes a similar number of keystrokes in my editor, and I even get to see highlight before it completes, so I’m not typing into a void. I think the thing is just that people who like to go deep end up learning vi, but it turns out if you go deep in basically any editor there are ways to do the same sorts of things with a similar number of keystrokes.

                      1. 14

                        There is not only the difference in the number of keystrokes but more importantly in ergonomics. In Vim I don’t need to hold 4 keys at once but I can achieve this by the usual flow of typing. Also things are coherent and mnemonic.

                        E.g. to change the text within the quotes I type ci”(change inner “) as the parent already explained. However this is only one tiny thing. You can do all the commands you use for “change(c)” with “delete(d)” or “yield(y)” and they behave the same way.

                        ci”: removes everything within the quotes and goes to insert mode di”: deletes everything within the quotes yi”: copies everything within the quotes

                        d3w, c3w, y3w would for example delete, replace or copy the next 3 words.

                        These are just the basics of Vim but they alone are so powerful that it’s absolutely worth to learn them.

                        1. 3

                          Just a small correction; I think you meant “yank(y)” instead of “yield(y)”.

                          1. 1

                            Haha yes thanks I really got confused :)

                          2. 2

                            And if you want to remove the delimiters too, you use ‘a’ instead of ‘i’ (I think the logic is that it’s a variation around ‘i’ like ‘a’ alone is).

                            Moreover, you are free to chose the pair of delimiters: “, ’, {}, (), [], and probably more. It even works when nested. And even with the nesting involves the same delimiter. foo(bar(“baz”)) and your cursor is on baz, then c2i) will let you change bar(“baz”) at once. You want visual mode stuff instead? Use v instead of c.

                            This goes on for a long time.

                          3. 6

                            One difference is that if you are doing the same edit in lots of places in your editor you have to do the cmd-shift-space backspace in every one, while in vi you can tap a period which means “do it again!” And the “it” that you are doing can be pretty fancy, like “move to the next EOL and replace string A with string B.”

                            1. 2

                              Sublime Text: ctrl+f search, ctrl+alt+enter select all results, then type your replacement.

                              1. 2

                                Yeah I just do CMD-D after selecting a line ending if I need to do something like that.

                            2. 3

                              I would remove the stuff in the quotes by doing cmd-shift-space backspace

                              What is a command-shift-space? Does it always select stuff between quotes? What if you wanted everything inside parentheses instead?

                              and then I say, it takes a similar number of keystrokes in my editor, and I even get to see highlight before it completes, so I’m not typing into a void

                              You can do it that way in vim too if you’re unsure about what you want, it’s only one keypress more (instead of ci" you do vi"c; after the " and before the c the stuff you’re about replace will be highlighted). You’re not forced to fly blind. Hell, if your computer is less than 30 years old you can probably just use the mouse to select some stuff and press the delete key and that will work too.

                              The point isn’t to avoid those modes and build strength through self-flagellation; the point is to enable a new mode of working where something like “replace this string’s contents” or “replace this function parameter” become part of your muscle memory and you perform them with such facility that you don’t need feedback on what you’re about to do because you’ve already done it and typed in the new value faster than you can register visual feedback. Instead of breaking it into steps, you get feedback on whether the final result is right, and if it isn’t, you just bonk u, which doesn’t even require a modifier key, and get back to the previous state.

                              1. 2

                                What if you wanted everything inside parentheses instead?

                                It is context sensitive and expands to the next context when you do it again.

                                Like I appreciate that vi works for other people but literally none of the examples I read ever make me think “I wish my editor did that”. It’s always “I know how I would do that in my editor. I’d just make a multiselection and then do X.” The really powerful stuff comes from using an LSP, which is orthogonal to the choice of editors.

                              2. 2

                                I do not disagree. For vim, as for your editor, the process is in both places somewhat complex.

                                Like you I feel I only want to learn one editor really well. So I choose the one which is installed by default on every system I touch.

                                For which I give up being able to preview what happens and some other niceties. Everything is a tradeoff in the end

                              3. 2

                                In a similar way, if you want to change the actual tag contents from “Stuff” to something else:

                                <tag style="tag stuff">Stuff</tag>
                                

                                you can use cit anywhere on the line (between the first < and the last >) to give you this (| is the cursor):

                                <tag style="tag stuff">|</tag>
                                

                                Or yit to copy (yank) the tag contents, dit to delete them etc.. You can also use the at motion instead of the it motion to include the rest of the tag: yat will yank the entire tag <tag style="tag stuff">Stuff</tag>.

                                Note that this only works in supported filetypes, html, xml etc., where vim knows to parse markup tags.

                              4. 2

                                I really like that I keep stumbling on tidbits like this one that continue to improve my workflow even further.

                              1. 4

                                For anyone who is more interested in the story about the creation of Windows NT, I can recommend the following book: https://www.amazon.com/Showstopper-Breakneck-Windows-Generation-Microsoft/dp/0759285780

                                1. 2

                                  I’m halfway through the book. Too many people to track and their relationships. If you start the book, it might help having a notebook and noting down names and who worked with / for who. It would make it more enjoyable.

                                  One thing I learned from the book so far is the Pai Gow game.

                                  1. 1

                                    I didn’t enjoy the book. It felt like a slog. I was hoping that the author would talk about the success of Windows NT. Would not recommend.

                                    1. 1

                                      Along those lines, I enjoyed Barbarians Led by Bill Gates as well.

                                    1. 7

                                      It’s hard to believe that Crystal has been around for over a decade. I remember when it was a just a fledgling language! Back then, Crystal and Rust both seemed to be competing for the niche of “Ruby-ish bare-metal language.” It’s interesting to see how their design has diverged over time.

                                      1. 18

                                        Rust, of course, is the only language in existence which offers run-time memory safety without garbage collection.

                                        I’m not sure if this holds, for instance, Swift does memory management without using a GC.

                                        1. 13

                                          And ATS, which provides the ability to do pointer arithmetic and dereferencing safely without garbage collection. In general, claims of “only one that does” and “first to do” should be avoided.

                                          1. 5

                                            ATS is the first language to have a “t@ype” keyword.

                                            1. 3

                                              ATS is very interesting! thanks for sharing it

                                              1. 2

                                                Check out Aditya Siram’s “A (Not So Gentle) Introduction To Systems Programming In ATS,” it’s a great overview.

                                            2. 11

                                              It depends a bit on how you define garbage collection. I’ve seen it used to mean both any form of memory management that does not have explicit deallocation or specifically tracing-based approaches. Swift inherits Objective-C’s memory management model, which uses reference counting with explicit cycle detection. Rust uses unique ownership. C++ provides manual memory management, reference counting, and unique ownership.

                                              1. 6

                                                Rust uses unique ownership. C++ provides manual memory management, reference counting, and unique ownership.

                                                Both Rust and C++ provide all three.

                                                1. 4

                                                  The problem is that C++ can also provide stuff you don’t want in your code usually - without using an unsafe {}.

                                              2. 5

                                                Ada meets that definition, too.

                                                Even modern C++ could claim to have run-time memory safety without GC, but that obviously requires the developer to use it correctly.

                                                1. 5

                                                  Ada isn’t completely memory safe, though I would say it’s a lot safer than C or C++ with all of the additional built-in error checking semantics it provides (array bounds checks, pre/post conditions, numeric ranges, lightweight semantically different (derived) numeric types, type predicates). I’ve found it hard to write bugs in general in Ada-only code. It’s definitely worth checking out if you haven’t.

                                                  As for modern C++, it feels like we made these great strides forward in safety only for coroutines to make it easy to add a lot of silent problems to our code. They’re super cool, but it has been a problem area for myself.

                                                  1. 3

                                                    Rust is also not completely memory safe: it has an unsafe escape hatch and core abstractions in the standard library as well as third-party frameworks require it.

                                                    1. 2

                                                      I agree. Not a lot of people are familiar with Ada, so my point was to dispel the myth it is completely safe, while also answering the common reply I’ve seen that “Ada isn’t memory safe, hence you shouldn’t use it.”

                                                2. 3

                                                  Isn’t atomic reference counting a form of GC as well?

                                                  1. 4

                                                    One could say that everything that deviates from manual memory management is some form of GC. Still, we do have the traditional idea that, generically speaking, GC implies a background process that deallocates the objects asynchronously at runtime.

                                                    1. 3

                                                      If you think about it, stacks are GC because they automatically allocate and deallocate in function calls. 🤔 That’s why they were called “auto” variables in early C.

                                                      Galaxy brain: malloc is GC because it manages which parts of the heap are free or not. 🤯

                                                      1. 1

                                                        ahahah great viewpoints, wow I learned so much with your comment, it got me looking into “auto” C variables. never realised that all vars in C are implicitly auto because of the behaviour that they get removed when they go out of scope 🤯 (I wonder how did they got explicitly removed back then? and how it all relates to alloca()? could it have been designed that way to allow for multiple stacks at the same time with other segments besides the stack segment?)

                                                        that last bit about malloc is amazing, it is indeed managing virtual memory, it is us who make the leaks 😂

                                                        1. 1

                                                          all vars in C are implicitly auto because of the behaviour that they get removed when they go out of scope 🤯 (I wonder how did they got explicitly removed back then?

                                                          Back in the day, as I understand it, there was no “going out of scope” for C. All the variables used by a function had to be declared at the very top of the function so the compiler could reserve enough stack space before getting to any code. They only got removed when you popped the stack.

                                                1. 4

                                                  I took a moment to look at the repo to see what it would take to submit a PR. The source seems to refer to these as “categories” as well as “tags”.

                                                  1. 2

                                                    See last paragraph of the Readme

                                                    1. 3

                                                      aha, https://lobste.rs/tags !

                                                      It looks like t/nix has been created for us! I’ve gone through and tagged everything referenced from the nix meta threads.

                                                  1. 1

                                                    Fully support!

                                                    Maybe config-as-an-os to capture Guix, Tvix, etc.? Probably too long for a tag, though. pkg-mgmt maybe, because I think that’s a sufficiently interesting topic on its own that includes these, plus package managers that aren’t essentially OS foundations or the science of package management itself (dependency resolution, retrieval, etc.). PackagingCon reminded me how many different aspects there are to the area.

                                                    1. 11

                                                      I used to agree, but bikeshedding the tag name disperses the energy and we end up with no tag at all, and another meta thread in 6 months.

                                                    1. 14
                                                      1. 7

                                                        Tvix and Guix in the same tag?

                                                        1. 10

                                                          Linux gets tagged unix despite technically not being one, so I guess it is close enough for anyone to care.

                                                          1. 8

                                                            sure, we can call it “nix-family” or something I guess

                                                            1. 13

                                                              Maybe too cute: nix-ish

                                                              1. 5

                                                                Maybe nix-y?

                                                                1. 3

                                                                  ix

                                                                  1. 2

                                                                    ix is *nix-y but not nix-y. IMO “nix” was a poor choice of name that was bound to cause confusion eventually.

                                                              2. 4

                                                                In that case why not make it more general and call it e.g. “package-management”? That would encompass not only nix, but also guix, tvix, dpkg, yum, portage, chocolatey etc.

                                                                It’s a lot more broad than just “nix”, but so are most of the other tags on Lobsters, with the exception being programming language tags. Maybe it could be combined with a new tag “operating-system” for NixOS/GuixSD.

                                                                1. 22

                                                                  I think that nix is so different that it should not be lumped together with other package managers

                                                                  1. 13

                                                                    I agree. While nix is technically a package manager, it has a vastly different approach to it. I’d go ahead and call the tag nix and post nix and nix-related things under it, and only if and when the GUIX people consistently take over that tag, at that point we can consider creating a tag for them too, but not before. because premature optimisation is the root of all evil.

                                                                  2. 19

                                                                    Every time a nix tag gets suggested, consensus seems to fizzle out as we discuss what the best name for an inclusive tag would be.

                                                                    At this point, I’m willing to stick with nix and not let perfect be the enemy of the good. We should have had a nix tag years ago!

                                                                2. 2

                                                                  I don’t see many Guix stories so it should be a non-issue.

                                                                1. 5

                                                                  I love Fish.

                                                                  ZSH is very configurable, and with a deep enough pile of plugins and configuration you can achieve much of what Fish does out of the box. The advantage of Fish is, you get all that seamlessly out of the box.

                                                                  The only two plugins I’ve installed are the tide prompt (reimplementation of powerlevel10k) and fzf for fuzzy history search.

                                                                  Broken POSIX compat isn’t a huge issue for me. I always had to look up documentation when using those features in bash/zsh, and I can always start a bash subshell if some build script is acting picky.

                                                                  1. 19

                                                                    This also got posted to HN, there’s a noteworthy discussion on some security concerns wrt. Linux-libre:

                                                                    Guix System is an advanced distribution of the GNU operating system. It uses the Linux-libre kernel

                                                                    It’s worth pointing out that the linux-libre kernel is developed under the FSF doctrine that “binary blobs are bad unless you can’t see them”. This has been taken to its logical extreme here, where this Linux fork actively removes security warnings informing users that they need to update their CPU microcode, because microcode in ROM is fine but dynamically loaded microcode updates are not, in this school of thought.

                                                                    https://lists.gnu.org/archive/html/info-gnu/2018-04/msg00002

                                                                    I have no interest in software that uses arbitrary religious dogma (that doesn’t help users’ freedom, as those users’ CPUs have proprietary microcode whether they know about it or not) to justify censoring critical security vulnerability notifications for users. I regard this as actively evil anti-user behavior.

                                                                    1. 6

                                                                      I’m a Guix user, and acknowledge that linux-libre’s microcode security/freedom decision is not what I’d pick. Many Guix users choose to use the vanilla kernel from https://gitlab.com/nonguix/nonguix#CPU%20Microcode for similar reasons.

                                                                      However, it’s not surprising that software freedom groups value freedom and will sacrifice security for it. That’s the nature of prioritizing values: some other important values will be second place.

                                                                      Values aren’t prioritized for no reason, however. Picking freedom over security in this way might have some positive effects (as well as the obvious negative effects):

                                                                      • microcode updates could downgrade the experience in ways the user doesn’t agree to.
                                                                      • it might encourage Intel to open their microcode specs/updates. This sounds far fetched, but we’ve seen large openness wins in the WiFi and GPU space over the past few years.
                                                                      • it might encourage users to purchase hardware that has open microcode updates.

                                                                      FWIW, I prefer free software, but am willing to sacrifice it for security at times.

                                                                      1. 5

                                                                        That’s a weird position for the guix though because you still run the microcode, you still get partial updates for it (bios), and they spent time to hide warnings. Trying to hide the fact you have the freedom to get the updates, because their idea of freedom doesn’t like the updates is serious mental gymnastics.

                                                                        1. 3

                                                                          I agree. I see this as a too large a security compromise for such a small win of “Freedom”.

                                                                          That said, drawing these lines makes it really clear what FSF/free software movement’s priorities are, which is important for public sentiment/recognition/visibility.

                                                                          When I think of FSF/free software movement I think “their goals align with mine, but I don’t always agree with their methods”. That’s a decent position for an advocacy group/movement.

                                                                          1. 1

                                                                            It doesn’t really matter the minutiae of the decision. Once these people have decided they know better than you what you should be allowed to know because they want to guide your behaviour for their religious crusade, they are not to be trusted with your OS.

                                                                          2. 1

                                                                            we’ve seen large openness wins in the WiFi and GPU space over the past few years

                                                                            We have? I thought free+open WiFi ended with the 802.11n Atheros chipset, and Nvidia is as closed as ever.

                                                                            1. 3

                                                                              NVIDIA is closed, but both AMD and Intel are doing pretty well with upstream Linux drivers as far as I know.

                                                                        1. 16

                                                                          This is a great release. I’ve been switching more and more of my personal repos over to flakes, and have been pretty happy with how they hang together. Hopefully flakes will make the shift from “niche folklore” to “well-understood by everyone” soon.

                                                                          1. 6

                                                                            Flakes are a killer feature. Classic Nix provides easy rollbacks and solves dependency hell, but git-tracked system definitions are next-level.

                                                                            I’m currently in the process of factoring my home system definitions to share a common repo. The DevOS project seems related but there are a lot of concepts to get up to speed on.

                                                                            1. 2

                                                                              You could already use git and nix quite easily, i just put nixpkgs as a git submodule for my home deployments.

                                                                          1. 4

                                                                            Quick question, why have you chosen to use a linux router, instead of the common bsd based options?

                                                                            1. 11

                                                                              Linux is far more common (though probably not Void) for networking outside of the link aggregator tech enthuiast bubble.

                                                                              1. 1

                                                                                is openwrt more popular than pfsense? or is this a roundabout way of saying maybe they want to do networking stuff beyond basic router functionality?

                                                                                1. 2

                                                                                  Considering plastic routers alone, yes, it’s more popular.

                                                                                  1. 2

                                                                                    According to Google Trends it seems like since 2010, PFSense has been more popular since 2016 worldwide, though there’s significant regional variation. OpenWRT seems much more popular in China and Russia than PFSense, for example.

                                                                                    1. 1

                                                                                      as opposed to metal ones?

                                                                                      1. 5

                                                                                        Most enterprise-grade “serious” routers are metal ones (often rackmounted), so yes. Most consumer ones are plastic. I assume that’s what calvin meant: “considering consumer-grade (i.e. plastic) routers alone”.

                                                                                        1. 1

                                                                                          so without that qualification I guess we don’t know what’s more popular. I made a half-assed effort and looked them up on distrowatch, but openwrt doesn’t have a page.

                                                                                    2. 1

                                                                                      pfsense? or opnsense?

                                                                                      1. 2

                                                                                        I don’t know is opnsense more popular? hard to find estimates for any of them

                                                                                  2. 5

                                                                                    When I build my original router, I also used it for Wi-Fi via the PCI-E card. At the time, FreeBSD/OpenBSD and others didn’t have a lot of support for 802.11ac chips (and definitely not in hostap mode). I did consider it back then.

                                                                                    I already had that one configured with standard iptables rules and it was running Void. It seemed like the simplest transition, even though I’ve now moved Wi-Fi to an external Netgear AP. I guess I could have gone a BSD route, but I wanted to get this done quick. The motherboard on the old router had one broken Ethernet port and I was using a USB3 1G Ethernet for the WAN. It’s been flaking out occasionally.

                                                                                    I’m also just already familiar with iptables and setting up routes on Linux, and I’m a big fan of Void Linux in general.

                                                                                    1. 2

                                                                                      Just FYI, that link needs fixing.

                                                                                    2. 3

                                                                                      As one example where I previously used a freebsd based firewall but switched to a linux based one was that freebsd, and derivatives, have poor pppoe performance due to a single threading issue (due to single nic queue issue).

                                                                                      https://forum.netgate.com/topic/138926/realtek-nic-pppoe-gig-cpu-usage-seems-odd/2

                                                                                      https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203856

                                                                                      1. 2

                                                                                        I’ve ran OpenBSD and pfSense (FreeBSD) on my router for a few years. pf is a great firewall, but it’s not so superior to nftables that it makes up for having to know two sets of networking commands.

                                                                                        I’m also in the midst of transitioning all my devices to NixOS, with a single shared repo for system definitions.

                                                                                      1. 2

                                                                                        This may have some impact on Windows (because they have core architectural mistakes that make processes take up to 100 milliseconds to spin up)

                                                                                        Do you happen to have a link with more details on this? I’ve heard that Windows is slow for processes/IO several times and I’d be curious to know why (and why they can’t fix it in a backwards-compatible way).

                                                                                        1. 5

                                                                                          There are a number of highly upvoted answers here but it’s hard for me to distill anything. It may be that these aren’t good answers.

                                                                                          https://stackoverflow.com/questions/47845/why-is-creating-a-new-process-more-expensive-on-windows-than-linux

                                                                                          1. 6

                                                                                            I think these are good answers, but I’ve had a lot of exposure to Windows internals.

                                                                                            What they’re saying is that the barebones NT architecture isn’t slow to create processes. But the vast majority of people are running Win32+NT programs, and Win32 behavior brings in a fair amount of overhead. Win32 has a lot of expected “startup” behavior which Unix is not obliged to do. In practice this isn’t a big deal because a native Win32 app will use multithreading instead of multiprocessing.

                                                                                            1. 3

                                                                                              I don’t think that is strictly correct. WSLv1 processes are NT processes without Win32 but still spawn relatively slowly.

                                                                                              1. 3

                                                                                                Hm, I remember WSLv1 performance issues mostly being tied to the filesystem implementation. This thread says WSLv1 process start times were fast, but they probably mean relative to Win32.

                                                                                                I suspect an optimized pico process microbenchmark would perform competitively, but I’m just speculating. The vast majority of Win32 process-start slowdown comes from reloading all those DLLs, reading the registry, etc. That is the “core architectural mistakes” I believe the OP is talking about.

                                                                                          2. 4

                                                                                            I don’t remember for sure where I saw this, but it may have been in the WSL1 devlogs? Either way I may have been wrong about the order of magnitude but I remember that Windows takes surprisingly long to spin up new processes compared to Linux.

                                                                                          1. 7

                                                                                            Nix is great for tracking dependencies but you really need to go all-in on making it your platform. To use a blood type analogy, Nix is a universal recipient of software; the polar opposite of a universal donor. Software like this helps, but it’s only useful for distributing programs with fully Nix’d dependencies.

                                                                                            I’m working on a project right now which involves a handful of Haskell executables and a Cythonized Python wheel. Nix bundle can easily package the Haskell programs since they don’t link against anything external; their only public interface is the command-line.

                                                                                            Building and distributing a Cython wheel which links against arbitrary other Python libraries is a separate challenge altogether. NixOS/Nixpkgs attacks this problem as a competing distribution of packages, when I really need something one level more meta.

                                                                                            Poking around Nixpkgs, I did find various libraries for building RPM packages, managing VMs and building containers

                                                                                            1. 2

                                                                                              Nix is great for tracking dependencies but you really need to go all-in on making it your platform. To use a blood type analogy, Nix is a universal recipient of software; the polar opposite of a universal donor. Software like this helps, but it’s only useful for distributing programs with fully Nix’d dependencies.

                                                                                              What would it mean for a platform manager to be a ‘donor?’ Are there examples of that?

                                                                                              It’s true that ‘Nix’-ifying a program sometimes requires modifying software. However, this modification - removing hardcoded dependencies - typically bears no long-term maintenance cost. For this reason, maintainers tend to be happy to do it. That’s been my experience, at least.

                                                                                              1. 1

                                                                                                I guess the “software donor” I’m thinking of would be better described as a build system. Imagine a tool which provides similar determinism/reproducibility as Nix, but helps you build “native” deb/rpm packages for target distros.

                                                                                                BuildStream is the closest fit I know of.

                                                                                            1. 18

                                                                                              I love reading these Nix success stories and then last night trying to simply install Grub on a system with zfs filesystem being literally impossible with the way my Nixos system was failing to derive something for no discernible reason, with no documentation anywhere and any reportings of that issue completely ignored :D

                                                                                              1. 7

                                                                                                I should just ruin it all and tell my secret. I don’t run NixOS. Plain nixpkgs on an LTS Ubuntu (boomer edition!) all the way.

                                                                                                I use Nix as a development helper, and, on rare occasions, deploy a service by sticking it in a systemd unit file and nix-copy-closure my way to success. Of course, that’s just for my gear. At $DAYJOB it’s the usual k8s circus.

                                                                                                1. 6

                                                                                                  Setting up Linux to boot from ZFS root is tricky even under the best of circumstances. What was the reported issue?

                                                                                                  I’m a huge fan of both NixOS and ZFS, but in the future I might aim for a tmpfs root and use ZFS only for persistent data.

                                                                                                  1. 5

                                                                                                    Nix is one of those technologies I think is amazing, but at the same time is practically unusable because of hard semantics and an inscrutable command line interface. It’s kind of like rust: dipping your toes and getting the tutorial working is easy enough, but the first time you are confronted with a real problem, finding the solution requires so much ancillary knowledge of arcane the minutiae of how the system works, it becomes a waste of time and solving it ‘the way I know’ is easier.

                                                                                                    1. 13

                                                                                                      I’ve also been totally consumed by the same obsession. Lots of money, too: I want to be able to distribute VQGAN models on multiple gpus, which is far beyond my minimal pytorch knowhow. So I’m now looking to pay a contractor.

                                                                                                      I have this dream of making 2000x2000 pixel murals and printing them to canvas. AWS has EC2 configs with 96 gigs of gpu. I can’t stop thinking about this, and it’s disrupting my life.

                                                                                                      But it’s also exhilarating. I know it’s “just” an ai generator, but I’m still proud of the stuff I “make”. Here are some of my favorites:

                                                                                                      My daughter wants to be an artist. What should I tell her? Will this be the last generation of stylists, and we’ll just memorize the names of every great 20th century artist to produce things we like, forever?

                                                                                                      I worry about this too, but also am excited to see what artists do when they have these tools. And I think it’ll make artists turn more to things like sculpture and ceramics and other forms of art that are still out of the machine’s reach.

                                                                                                      EDIT: also, a friend and I have been making games based off this. “Guess the city this from this art” or “guess the media franchise”. It does really funny stuff to distinct media styles, like if you put in “homestar runner”

                                                                                                      1. 5

                                                                                                        Just my random observation but “your” pieces and the post’s all give the vague appearance of something running through endless loops of simulacra. Said another way, they all share similar brush strokes.

                                                                                                        I think we’re headed into the (while looking at a Pollock) — “humph, my AI could have painted that!” era

                                                                                                        1. 4

                                                                                                          There are a bunch of known public Colab notebooks but one is very popular. It’s fast but has this recognizable “brush stroke” indeed. Some GAN jockeys are tweaking the network itself though, and they easily get very different strokes at decent speeds. You don’t even need to know neural network math to tweak, just the will to dive in it. Break stuff, get a feel for what you like. If this is to become a staple artist’s tool it’ll have to be like that, more than just feeding queries.

                                                                                                        2. 3

                                                                                                          These are cool. The “Old gods” one especially… if that was hung in your house and you told me you’d purchased it from an artist I wouldn’t blink. When you make them, are you specifying and tweaking the style, and then generating a bunch, and then hand-picking the one you like?

                                                                                                          1. 3

                                                                                                            Starting out I was just plugging intrusive thoughts into colab to see what I’d get. If it didn’t produce something interesting (not many do) I’d try another prompt. Recently I spent a lot of time writing a “pipeliner” program so I can try the same prompt on many different configs at once. I got the MVP working on Monday, but I’m putting it aside a while so I can focus on scaling (it only works on one GPU, so can’t make anything bigger than 45k square pixels or so)

                                                                                                            1. 1

                                                                                                              Are you saying you’ve managed to get this to run locally? All the guides I’ve found are simply how to operate a Colab instance.

                                                                                                              1. 2

                                                                                                                I got it running locally, but I don’t have a GPU so upload it to an EC2 instance. I recently found that SageMaker makes this way easier and less burdensome, though.

                                                                                                            2. 1

                                                                                                              I printed the old gods to canvas and it came out pretty good.

                                                                                                              1. 1

                                                                                                                Nice. Do you have pic?

                                                                                                            3. 1

                                                                                                              There are neural nets intended specifically for upscaling images. Pairing one of these with VQGAN image generation (which is pretty low res) might let you make larger scale art without a huge unaffordable GPU.

                                                                                                            1. 8

                                                                                                              A path length which exceeds 1GB, holy moly!

                                                                                                              1. 1

                                                                                                                My thoughts, exactly.

                                                                                                              1. 7

                                                                                                                There are some excellent upgrades I’m embarrassed to say I only learned about recently. Perils of working in a Microsoft environment so long, I suppose.

                                                                                                                • rg ripgrep instead of grep, way faster and respects .gitignore
                                                                                                                • fd instead of find. No need to type find -iname "*foo*" all the time, just fd foo
                                                                                                                • et Eternal Terminal instead of ssh, to keep my session live through reconnects

                                                                                                                And I’ve been experimenting with some newfangled toys tools as well

                                                                                                                • zsh + powerlevel10k for an extremely fast prompt with doodads
                                                                                                                • zsh + fzf for fuzzy history searching
                                                                                                                • fish for incredible ergonomics: autocomplete, advanced syntax highlighting, multiline command editing
                                                                                                                • fish + tide instead of powerlevel10k
                                                                                                                • fish + fzf, same reason as zsh
                                                                                                                • bat instead of cat for pretty colors and line #s
                                                                                                                • poetry for managing Python builds in a declarative way that I’m used to from Nix
                                                                                                                • spacemacs as a drop-in replacement for vim. the syntax highlighting is way better

                                                                                                                Most of these upgrades boil down to either ‘go fast’ or ‘more intelligent use of color’.

                                                                                                                1. 1

                                                                                                                  Have you tried treesitter with neovim 0.5? I’d like to hear from someone who thinks vim’s syntax highlighting is bad and something else is good. I’m on the edge of trying to switch for a week, but haven’t had the time…

                                                                                                                  1. 1

                                                                                                                    I haven’t yet, but NeoVim is definitely on my radar. I’m excited to try out Neorg as well.

                                                                                                                  2. 1

                                                                                                                    et Eternal Terminal instead of ssh, to keep my session live through reconnects

                                                                                                                    Wait, are you Jason Gauci? I heard of this through him. He has an excellent podcast besides making that.