HackerTrans
TopNewTrendsCommentsPastAskShowJobs

Brentward

no profile record

comments

Brentward
·2 lata temu·discuss
I agree that the comment sounded pretty hostile, but I also agreed with the assessment that it might be better to avoid allocation in general. I know the code in the post is highly simplified, but you aren't exactly fully using "lazy iterators," at least in the post. refresh/load_hotels is still allocating new Hotels, each of which contains a one-million-element Vec. If you could reuse the existing self.hotels[id].prices Vec allocations, that might help, again at least in the example code.

On second glance, I guess this is what you're getting at with the ArcSwap comment in the post. It sounds like you really do want to reallocate the whole State and atomically swap it with the previous state, which would make reusing the prices Vec impossible, at least without keeping around two States and swapping between them.

Anyway, tone aside, I still think the comment had validity in a general optimization sense, even if not in this specific case.
Brentward
·2 lata temu·discuss
Yes, at least the parts that my research group used regularly. I ported them to Rust, though, not modern Fortran. They're also pretty specific to computational chemistry, rather than general packages like PRIMA, but I'll link them here in case you're curious anyway. I was also still learning Rust and followed the original Fortran API and naming scheme where possible, so this code could use a refactor too! But at least there are no gotos.

https://github.com/ntBre/anpass - ordinary least squares fitting https://github.com/ntBre/intder - internal coordinate transformations https://github.com/ntBre/spectro - vibrational perturbation theory

PRIMA looks very interesting, by the way. I may see if I can get some use out of it in my research!
Brentward
·2 lata temu·discuss
In grad school I worked on three separate Fortran code bases written as early as the 80s with tens of thousands of lines, no source control or version history, no build systems or even build scripts, and no tests. I think a lot of old scientific software is in the same condition, with some mix of "if ain't broke don't fix it" and the code being very hard to refactor.

This quote from the linked PRIMA page pretty much sums up my experience porting the above code too: "I hope I am the last one in the world to decode a maze of 244 GOTOs in 7939 lines of Fortran 77 code — I did this for three years and I do not want anyone else to do it again"
Brentward
·3 lata temu·discuss
Yeah the article says these "aren't used anymore," but my image viewer (sxiv) complained that the gif was corrupted until I put something there. It still displayed the image, but it also complained afterwards.
Brentward
·3 lata temu·discuss
Those examples contain overlap, but not in the first or last digit that is given as the solution. So from the instructions you can't tell that the intermediate list of numbers should be 8, 2, 3, you only know that the final answer is 83.
Brentward
·3 lata temu·discuss
I thought it was going to be the Excel DNA to date conversion.

https://www.theverge.com/2020/8/6/21355674/human-genes-renam...
Brentward
·3 lata temu·discuss
The second edition is out! I started reading it last week, and it's great so far.

https://www.awk.dev/
Brentward
·3 lata temu·discuss
Personally, I got tired of weird quirks like this with vterm and now bind this command to the key I used to have vterm on to spawn my actual terminal (st) in my current directory. It's probably not what most people want from vterm, but I prefer it.

  (defun open-term-here ()
    "open st in `default-directory`"
    (interactive)
    (call-process-shell-command
     (concat "st bash -c \"cd "
      default-directory
      " && exec zsh\"")
     nil 0))
Brentward
·3 lata temu·discuss
In org-alert we use `org-map-entries` and a simple `org-alert--parse-entry` function for stripping out the details we're looking for. Depending on what you want, it's not exactly a data structure, but maybe it will help you get started!

https://github.com/spegoraro/org-alert/blob/master/org-alert...
Brentward
·3 lata temu·discuss
It already is! I've been building Emacs from the development branch for the last couple of years, and the improvements in 29 and now 30 have really been great. I barely remember the sluggishness the other comment mentions.
Brentward
·3 lata temu·discuss
He links to a page about ARM MTE in the section where he talks about memory tagging and CHERI for the first time.
Brentward
·3 lata temu·discuss
I agree, it's not about it being "easy" to find the documentation or "easy" to watch the video. This is the landing page for the project, and I'd much rather see the commands in the video listed out on the page rather than having to watch someone else's terminal session.

I was recently looking at nushell, and that website has exactly what I would expect to find: example input with screenshots of the output instead of a video.
Brentward
·3 lata temu·discuss
The example in previous versions of the Go math/rand package suggested using time.Now().UnixNano() to seed the RNG source since that's essentially a random int64.
Brentward
·3 lata temu·discuss
Not sure exactly what they meant, but I assume most arguments in this vein have something to do with form. A well-executed deadlift is a great exercise, but you have to balance the risk of injury, especially for new lifters without a trainer or coach to help with their form.
Brentward
·3 lata temu·discuss
For strength training StrongLifts seems like a good program. It used to be highly recommended on the fitness reddits, but I haven't followed them for a few years. Regardless, I think it's a solid program for starting strength training. I do more of a bodybuilding/bro split, but I've been mixing in a couple of heavy days modeled after the StrongLifts plan. It's certainly simple if nothing else.

https://stronglifts.com/5x5/
Brentward
·3 lata temu·discuss
So write it locally in an unshared document and paste it into overleaf when you want someone else to see it? I don't like overleaf to begin with, but to feel this tied to it is a bit wild.
Brentward
·4 lata temu·discuss
I think that's pretty clearly not the point. As someone who has worked with legacy scientific code written in Fortran, the copying is not the issue, it's blindly copying code that was written 50 years ago, probably by a graduate student, and not reviewed or revised in any way since. As the parent comment points out, if everyone reuses that code, the same errors propagate. It's not the type of reuse that comes with a nice GitHub repo and an established mechanism for reporting and fixing bugs.

In my case, one of the Fortran files essential to my group's research has 11 (!) versions with only filenames like file.f.goodworking (that's literally one of the extensions) to differentiate them and no version control or history.
Brentward
·4 lata temu·discuss
Can't you just provide a default implementation of the method on the trait itself? Unless there are more requirements I'm not parsing from what you wrote, that seems to do exactly what they wanted.
Brentward
·4 lata temu·discuss
To expand on the other reply, there are a couple more implicit loops. There's a loop over all of the command line arguments/files, then a loop for every line in each of those files, then there is kind of a loop over the whitespace delimited fields of each of those lines. The main thing that helped me understand AWK was that every block in a script is just a pattern/action pair. When I saw snippets like

  ... | awk '{print $2}' 
I thought there was all this confusing syntax, but something like

  awk '/pattern/ {print}'
was more clear to me. In the first case, the empty pattern matches every line of the input, and the action is simply to print the second field of each line. Patterns can vary in complexity from the empty pattern to long chains of logical operators and regular expressions, such as /pattern/ in the second example. The outer quotes are just to prevent the shell from eating your dollar signs or other special characters. In a standalone AWK script you can write it like

  /pattern/ {
    print
  }
which also makes it look more like another language.

If you can get your hands on a copy of The AWK Programming Language, it's a pretty quick and pleasant read that helped everything make more sense to me. I do most of my data analysis for my research using AWK and really enjoy working with it.