Better HN
topnewbestaskshowjobs
Log inSign up

ColonelPhantom

645 karma · joined Oct 28, 2016 (10y ago) · 374 submissions

Submissions

comment 4y ago · link · parent

You missed the point; an if or for is a single token. The problem is with predictable token sequences, and if you write the same for loop (or extremely similar ones) in multiple places then yes, it should be turned into a function.

comment 4y ago · link · parent

> Also, how is that different from Google's scraping whole internet?

Many reasons: Google Search provides sources, it links to your website. Copilot only gives the content. Google also doesn't suggest including its search results in your product verbatim.

comment 4y ago · link · parent

Many FOSS developers use copyleft licenses to ensure that only FOSS benefits from their code.

Copilot suggesting it for inclusion into proprietary codebases is then effectively whitewashing that GPL code.

Copilot also does not provide attribution, which is a legal requirement of tons of permissive licenses, including MIT and BSD.

comment 4y ago · link · parent

And then I will download a trial of the resulting binary, and send a GPL compliance letter to the company. Unless they took care to use dynamic linking in the LGPL case, they are legally obliged to send me the source code under the license, so I can release it all as FOSS under that license.

comment 4y ago · link · parent

I think the problem is not that "not all tokens are valid" Rather it is that we often repeat the same token sequences, and we should seek to abstract those predictable sequences into more unique tokens, e.g. by turning it into a library function.

Of course, the downside is that now you have way more tokens you need to know to understand some code, similarly to how Haskell code tends to have tons of mega-abstract function combinators or whatever whereas Go code is very simple. Which one is more readable depends on the reader, because a language like Go requires the reader to sift through more details, whereas Haskell is much terser but also requires much more pre-existing knowledge to understand.

I'm wondering if we can use these code-generation models to find "low entropy code" that is a prime target for turning into libraries.

comment 4y ago · link · parent

>Linux blurs the line between 3rd party software and system dependencies

How does BSD avoid this? I guess package manager installed software does get lumped in, but is that really 3rd party software in a meaningful sense? I very much like how it's all in one place.

User-installed software usually gets installed into /usr/local or /opt, which is separate from the system-managed trees.

comment 4y ago · link · parent

Well, it's definitely artificial, and looking at how it plays chess it is arguably a form of intelligence as well. Implementation details are secondary.

Also, why can't a brute force algorithm not be AI? Machine learning is arguably brute force too; a neural network just brute forces some realistic sentences by doing a bunch of matrix multiplications, if you get down to it.

comment 4y ago · link · parent

Those lawsuits are necessary in order to protect free software.

They have also brought us much good, as without the GPL you wouldn't have OpenWRT or LineageOS, projects which typically depend on vendor-provided kernels or drivers in order to function.

comment 4y ago · link · parent

>I'm saying it caught actual bugs in my code.

It did so 5 times, versus how many times it gave a false positive where you just had to delete the import or underscore the variable?

Warnings are intended precisely for this type of "hey, you probably made a mistake here". Errors should imo be reserved for cases where the compiler is more or less sure you are wrong.

Rust has probably the biggest possible focus on "making sure only correct programs compile", and rustc does not error on an unused variable or import; it gives a warning. Precisely because it does not know if it is a bug, or just, I don't know, "commenting out the code that uses it to try something".

Also, in the case of an unused variable, you CAN blow it off, by using _. In fact, this makes it far easier to forget about it later compared to a warning that can be silenced in the same way, because if it's a warning you'll only do it if you're actually sure, while with an error you might do it even if you're less certain, because it's absolutely necessary.

comment 4y ago · link · parent

I work on a Python/Django project, and frankly, that hasn't been my experience at all. Poetry makes per-project dependency management using venvs a breeze. There are a few deps on native libraries, such as libjpeg, so you do need to make sure those are installed, but the needed libraries are quite easy to find on most systems, and our Dockerfile only lists a dozen or so apt packages. There are also a lot of Mac users on our team, and they don't have any issues either.

Sure, it's not as nice or compact as a single binary, but "you'll be lucky if you can run on any non-Ubuntu/RHEL system" is massively overblown.

comment 4y ago · link · parent

Shouldn't it be a warning, though? You'll still notice it, but you aren't forced to deal with the problem immediately.

comment 4y ago · link · parent

Sure, but 16-bit float is pretty primitive compression, as it does not exploit any redundancy in the input. zfp groups numbers together in chunks, which means that correlated numbers can be represented more precisely. Its algorithm is described here: https://zfp.readthedocs.io/en/release1.0.0/algorithm.html#lo...

I would like to see if the zfp can be applied to something like Stable Diffusion (or other ML models) and give better results than regular floats at the same size.

comment 4y ago · link · parent

> Also, ML models (probably) can't be compressed because they already are compressed; learning and compression are the same thing!

I feel like they're kind of two sides of the same coin: learning is about putting more information in the same data, while compression is about putting the same information in less data.

I'm wondering if some lossy floating-point compressor (such as zfp) would work.

comment 4y ago · link · parent

Especially as compiling often and proper indentation are often taken care of by running a linter and an autoformatter.

I'll add "learning how to use a debugger", though.

comment 4y ago · link · parent

In Django, you would write an annotation as documented at https://docs.djangoproject.com/en/4.1/topics/db/aggregation/...

So something like

  Album.objects.annotate(duration=Sum('track__length')).order_by('duration')
There are also libraries that enable you to define an annotation or aggregation inside a model, that you can then get with a call like select_properties, similar to the built-in select_related (which you use to get a foreign key in one query) and prefetch_related (which is select_related for many-to-many fields).

comment 4y ago · link · parent

Why does the index need to fit in "cash" (cache RAM)? Generally an index on disk, especially SSD, is far faster than traversing the entire dataset, because it allows the query executor to quickly narrow it down. Even if this requires some disk IO, it's a lot faster than doing all the disk IO for the entire dataset.

comment 4y ago · link · parent

> The problem is that newer versions have fewer links to them, so they seem less authoritative.

Ah, that makes a lot of sense actually, thanks for explaining! The heuristics idea sounds neat.

Sounds like it's running on surprisingly little hardware. Is the index stored on a separate SSD?

comment 4y ago · link · parent

Yes, there is a plugin for it! https://github.com/lite-xl/lite-xl-lsp

It works quite decently, although again limitations regarding linewrapping apply; the inline lints from lint+ break linewrapping :/

Also, for Lapce I cannot find server integrations other than a few, namely Rust, JS/TS, YAML, C/C++, Go and Dart. No Python, for example. Adding Python support in Lite's LSP is as simple as adding lspconfig.pylsp.setup() to your config (and installing the server), if you already have the plugin set up correctly.

comment 4y ago · link · parent

Lite XL (lite-xl.com) is also extremely fast. Also, because a lot of it is written in Lua, you can very easily extend it yourself; you can just monkey-patch many functions and do what you want!

It's kind of immature in some ways, for example, the current release version has some limitations in the native plugin interface (which you need for loading C libraries for Lua, as Lite may use a statically linked version), and there is a conflict between the linewrapping and projectsearch plugins where opening a file from it is bugged if you have linewrapping enabled by default.

Lapce does seem more advanced in some ways, but IMO the enormous hackability of Lite is also a nice advantage.

comment 4y ago · link · parent

Seems neat, but trying to find Django documentation is not ideal: searching for "django prefetch" has GitHub repos as the first two results, and the third result is official Django documentation but for an ancient version, something that annoys me about other search engines too.

Out of curiousity, what kind of hardware are you running this on? I can imagine that you'd need a lot of storage to store the index, but the size of plain text can often be surprisingly small.

comment 4y ago · link · parent

Barrel shifters are huge in the context of small CPUs (especially on FPGA's). To do a barrel shift, you need (input size) * (shift size) LUTs, as you need that amount of "stages". That means 32*5=160 on RV32, as you can shift by 2^5 bits.

OP's CPU takes up around 400 LUTs. Since a 2:1 mux takes up 1 LUT (although it seems the numbers are for a LUT6-based device, which can take a 4:1 mux, so maybe that can make the amount a bit lower?), you would add 160 LUTs. That's quite a lot.

comment 4y ago · link · parent

For games, the PC Gaming Wiki is a treasure trove of "how do I get game X running on modern machines". Usually the culprit is either an ancient version of DirectX for 1990s titles, or DRM for the 2000s. And usually there's a crack/patch for the DRM, and for DirectX you can use tools like dgVoodoo.

comment 4y ago · link · parent

For Rust, any LSP-supporting editor with rust-analyzer should be giving a great experience. Not sure what you mean by "multi-file" projects, but RA handles a normal crate with multiple modules perfectly fine.

comment 4y ago · link · parent

What VCS were you coming from, and what makes Git so much nicer?

I believe Git and Mercurial are considered to be 'about as good' by most.

comment 4y ago · link · parent

I believe HTMX is also a rewrite (at least to some degree) of Intercooler, as it uses vanilla JS instead of jQuery.

comment 4y ago · link · parent

I guess you could shell out to check for errors (for example), but isn't it in general nicer to get error messages as you go? Or how about actually intelligent autocomplete? Stock vim simply cannot do those.

What are some examples of plugins people commonly use that you think are useless?

comment 4y ago · link · parent

If you want half-assed keyword based completion, you don't need any plugins at all (e.g. ctrl-n in vim).

And if you install a proper plugin that uses language servers, you're at the same level of VSCode, which I'm pretty sure is the most used editor by a wide margin.

Your rant sounds more like you're more annoyed by "wannabe-vim-hackers" than any actual limitations of the tools.

comment 4y ago · link · parent

Power efficiency isn't actually the point on desktop. The point is that a Gracemont cluster is around the same size as a Golden Cove core, while being faster in multithreaded workloads. However, because they're slow at lightly threaded work you still need some really fast cores too.

Because Gracemont is so small, a chip can pack more MT performance for the same price.

comment 4y ago · link · parent

That's not quite true, the other commenter already mentioned LLVM vs. AMD's proprietary shader compiler, and I think ray-tracing support has also been present in the AMDGPU-PRO driver for quite a while but is only just now starting to appear in the open AMDVLK.

comment 4y ago · link · parent

The AMD situation is even more complicated than that: you have both AMDGPU/AMDVLK and AMDGPU-Pro/AMDVLK-Pro. This exists in parallel to Mesa's RADV, so there are three Vulkan drivers for AMD for Linux.

I do believe that AMD actively supports the radeonsi Gallium driver in Mesa, so I don't think that AMDGPU ships with a custom OpenGL driver, but I'm not too sure on that.

1
910111213