Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

It's a real struggle for cuisine.

One example is french baking. Any good break or croissant is very hard to reproduce in some countries, like Thaïland or Australia, because of the climate. Temperature and humidity plays a huge role.

Also you can't source the same ingredients.


When you start to need error handling.


...unix return codes?

Sorry even I can't say that with a straight face XD


I was pleasantly surprised it loaded so fast.

So I wanted to check the size of it.

I opened the firefox debugger, and it went blank O_o

Chrome was ok with it: it's about 220kb, which is not bad at all for a whole runtime + stdlib. Python pyiodide (https://pyodide.org/en/stable/) is several Mb.

220kb is still too much to pay upfront, since I usually want my webpages to be under 1Mb, and I can't justify burning 1/4 of the size budget.

As for the Firefox story, maybe it's a good obfuscation trick :)


57k post Brotli. Measuring the decompressed size of your page's static text content is like measuring your static image content by the size of the decompressed bitmap the browser generates instead of the size of the PNG (or whatever format). Server side both examples should be precompressed as they are static assets.


Uncompressed size matters for parse time. Although you are correct about network latency.


220kb is fine for a parse time alone, you'd ship Fengari in a separate bundle, probably in a worker.

Speaking of bundles, the webpack loader is pretty cool, it allows you to import .lua files: https://github.com/fengari-lua/fengari-loader


If the goal is strictly to keep things low on bandwidth compressed size is all that matters. If the goal is strictly to keep things fast time to various user events is all that matters. If the goal is a balance of both then both will matter. In none of these is uncompressed asset wire size <1 MB the relevant metric. Nor parse time based on uncompressed size even.

Barring any other information whatsoever while knowing a script is 10 MB vs 10 KB should give you a strong hint on "parse time" it's not actually telling you what the metric is named for which should be a red flag. What you actually want to know is what the parse time was regardless of what the file size was or, more likely in the bigger picture, how using the resource changes time to certain user noticeable events. Perceived slower pages much smaller than 1 MB are certainly easy to generate by optimizing for the wrong things as are perceived faster pages with much bigger payloads.

On the other hand if you're just using 1 MB as a quick and simple yardstick you probably don't intend to measure some of your assets compressed and some others uncompressed, particularly when picking which to axe.


It matters very much on mobile, decompression + parsing can really hinder loading page.


>I opened the firefox debugger, and it went blank O_o

No problems here?


Lua definitely does not have the power of something like Python.

That's usually what people like about Lua: it's barebone, yet high level and clean.

If one likes Python, then the chance of liking Lua are low.

E.G:

Both python and lua can open something (a file, a socket, a transaction...) in one line.

But only Python has the `with` construct that means it's easy to guaranty you close it in case of an error.

Lua is then easier to learn: one less concept to master. But the high level tool of Python, that you had to learn, make your life easier.

They have very different trade off.


> If one likes Python, then the chance of liking Lua are low.

I don't know. I quite like both as well. The design ethos feels similar although Python has certainly added more features over the years.


"with" existed in python 2. In python 2.6 in fact, like comprehension lists, decorators, generators, descriptor protocol, exotic slicing assignation, advanced nested unpacking, infinite parameters...

Python was always chock-full of advanced features, people just usually don't notice because they get productive in 3 days with the basic features and don't need to go further. It's has the quality of a very smooth learning curve, but a very long one if you care.


"with" and "defer" (Go) are nice but not crucial to me.


My point exactly.


Lua 5.4 has to-be-closed variables that are similar in functions to with blocks in python.

Unkike the __gc hook which provides no guarantee as to when it will be called, if ever, the __close hook is called when a value goes out of scope.

http://www.lua.org/manual/5.4/manual.html#3.3.8


" It also means that you can always check out a different commit without first explicitly committing the working copy changes (you can even check out a different commit while resolving merge conflicts)."

That's really interesting. Having to manage stashes is annoying.



Surprise limitation: you cannot have two worktrees set to the same branch, or at least that confronted me when I tried it.


If you had two worktrees set to the same branch and made a new commit in one of them (thus changing the commit the branch ref points to), what would happen in the other worktree?

Either it wouldn't have the right commit checked out anymore, or git would have to miraculously change what files are checked out in it -- which would likely come as a big surprise to whatever you were doing in that working tree.

Ergo, it is forbidden.

I periodically find myself creating a new (temporary) branch referring to the same commit when I want a new worktree looking at the same place, or just create a new worktree with a detached HEAD looking at the same commit.


Git could hide this for you and just make it look like you cloned the repo twice.

What happens if you make a commit in dir1 and dir2 is on the same branch. Absolutely nothing, until you fetch, and worktrees could work the same way. If there is any ambiguity left you could prefix the branch names similar to the remotes origin/master, worktree2/master.

The only sane way to use worktrees today is, like you say, with detached heads. Which well…isn’t that sane for many other reasons.


If you want a separate clone you know where to find it, but then you will be plagued by the uncertainty I mentioned in my other comment (https://news.ycombinator.com/item?id=30400869).

I did not say that was the only sane way to use worktrees. I frequently use them for separate strands of ongoing work (on separate branches per work strand, named appropriately). Less common (for me) is the use case of easy reference to older versions, with more ephemeral worktrees checking out a tag, a new branch (created for the purpose, and short-lived), or a particular commit (viewed as a detached HEAD).


git could simply prevent you from committing to that branch in that case, and perhaps print a warning when adding a worktree. The current behavior is weird. Another alternative is to allow the commit, but leave it in a detached-head state, and let the user choose how to fix that retrospectively.

The way I use worktrees I'd say the majority are read-only anyhow, so abiding by restrictions because it might get confusing if a commit were made is pretty annoying.


That's not correct. You can use --force to to create a duplicate worktree pointing to the same commit-ish: https://git-scm.com/docs/git-worktree#Documentation/git-work...


Can you elaborate on why you would want two worktrees set to the same branch? I think if I were trying to compare two approaches involving incompatible changes, creating a branch for one approach would feel more natural anyway, and then I'd be able to use the worktrees.


What is the advantage of using worktrees over another checkout in another folder?


When you're done with a worktree, you just delete it (via `git worktree remove`). Any additional branches or stashes etc are part of the repository that the worktree was part of, and they (of course) remain.

When you're done working in a separately cloned repository in another folder, if you're anything like me, before deleting it (via `rm -rf`) you'll want to check very carefully for additional branches, unpushed work, anything stashed. Deleting an entire repository that's been around for a while is a risky operation in that it may have accumulated other unrelated work in addition to the current branch (which was the primary reason for the clone), and you'll want to check carefully before deleting the whole lot.

Additional worktrees within the same repository are great for medium-term ephemeral separate strands of work. They can be created and removed without concern.


Duplicate storage as already mentioned, but you will also lose the ability to merge / doff cross branches if you have separate checkouts.


Why would you lose that ability? You can just pull from the other checkout as an upstream, right?


Worktree allows you to checkout other branches, stashes or commits which are local only / not yet pushed.

What’s also great is that you don’t need to do a pull in the other folder. Before I discovered worktree, I had my repository checked out in two places, so was either pulling both constantly, or when I needed the alternate, it was often very far behind and I had to pull a lot.


Hmm, I tried it once and iirc I couldn't see commits/branches of the other workspace without pushing and fetching so I really didn't see any difference. With different checkouts you can also easily do that by adding the other checkout as a remote.


Not sure what you were doing wrong, but I use worktree regularly and you can absolutely see the same commits from both the primary and worktree side.

The great thing about worktrees is that everything local is still available in the worktree and vice-versa, you can even stash push on the one side and pop on the other. You also don’t need to push or pull on either side first.

I have noticed that for submodules, although they share the .git folder, they don’t share references, so you can’t see local branches and stashes between the worktrees, but sub module pulls are still quicker since they share objects so those don’t need re-pulled on the other folder.


Something probably got messed up on your setup (or maybe you checked out a commit instead of a branch?) because you definitely can see all worktrees' branches from inside each other when using git worktree.


That makes sense. Now I think about it, The issue probably was that I was working in a submodule and those branches are probably not shared.


Yes, as per my other comment, I’ve noticed with submodules that the references are isolated between the different folders, but they do share the same objects in the .git folder, so you still get efficiency there in not needing to store or pull duplicate data.


You will need a full repository in other directory to checkout and this will waste storage unless you share objects via alternate.


Optimizations and management really


How do you use worktrees with an IDE ? Do you have one project per tree ?


rebase.autostash=true is also a thing, but the "working copy as commit" concept does look more interesting.


More likely: our gov gag ordered us to keep up.


It depends of the context, as usual. It's usually not a problem for me, but sometimes I ask some of my clients that they do something technical on their part so I can continue my mission. Then someone at their IT department says it can't be done, or say it will take <very long time>, cost <lot of money>, etc.

My client arm wrestle with them for a bit, then turn back to me and ask if I can do something anyway. So I charge them to do the task that can't be done, and it doesn't take that much time or money.

But I learned to do that with gloves, and tons of ass licking, because it does make the other party look bad.


> it's increasingly common to lie with statistics.

I'm pretty sure it has always been the case: ""Lies, damned lies, and statistics" can be traced back at least as far as 188x.

Besides, the chain of lies is super long. Sample selection. Data collection. Data analysis. Reporting. Publishing. At each steps, so many things can go wrong: errors, agenda, corruption, bias...

In the case of Covid, we already have plenty of terrible communication from the entities at play, so at this point, it's kinda hard to have an informed opinion.


Also, we don't know yet if the hallucinations are part of the therapeutic value of of the psychedelic compounds.


I was going to say the same. The accounts I've heard of people successfully using ibogaine to overcome life-destroying addictions focused on the critical value - and content - of the visionary effects in helping them change.


If you want a webmail, which most people do, their archi makes sense.

How else are you going to do it ?

Balance between security and usability, as usual. If you want more, use pgp, but loose most users.


If I want to remove the airbags from my car and strap a gigantic bomb in there instead, this particular method of doing it makes sense.

I mean, yes, that's true, but it's still a bad idea.

> Balance between security and usability, as usual. If you want more, use pgp, but loose most users.

They could just have a local client. Thunderbird/Outlook/whatever isn't exactly difficult to use, even for non-technical people.


> They could just have a local client.

They do. This is what ProtonMail Bridge is.


Indeed, and yet a lot of users still use the webmail, because everything in IT is a compromise.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: