|
Travis is basically dead nowadays, so let's remove it.
|
# ? Oct 8, 2021 07:35 |
|
|
# ? Jun 7, 2024 03:41 |
|
Linked from that tweet is another delightful reference. https://twitter.com/juliawritescode/status/1446270669843582976?s=20 pre:pub fn now() -> Instant { let os_now = time::Instant::now(); // And here we come upon a sad state of affairs. The whole point of // `Instant` is that it's monotonically increasing. We've found in the // wild, however, that it's not actually monotonically increasing for // one reason or another. These appear to be OS and hardware level bugs, // and there's not really a whole lot we can do about them. Here's a // taste of what we've found: // // * #48514 - OpenBSD, x86_64 // * #49281 - linux arm64 and s390x // * #51648 - windows, x86 // * #56560 - windows, x86_64, AWS // * #56612 - windows, x86, vm (?) // * #56940 - linux, arm64 // * https://bugzilla.mozilla.org/show_bug.cgi?id=1487778 - a similar // Firefox bug // // It seems that this just happens a lot in the wild. // We're seeing panics across various platforms where consecutive calls // to `Instant::now`, such as via the `elapsed` function, are panicking // as they're going backwards. Placed here is a last-ditch effort to try // to fix things up. We keep a global "latest now" instance which is // returned instead of what the OS says if the OS goes backwards. // // To hopefully mitigate the impact of this, a few platforms are // excluded as "these at least haven't gone backwards yet". if time::Instant::actually_monotonic() { return Instant(os_now); } Instant(monotonic::monotonize(os_now)) }
|
# ? Oct 8, 2021 17:38 |
|
Volmarias posted:Linked from that tweet is another delightful reference. Oh god, ye olde backwards running system clock. I've had to debug something like this.
|
# ? Oct 8, 2021 19:49 |
|
I'm surprised Rust doesn't have something like steady clock. That's been around in C++ for a while now and they could've ported it over. I mean I guess technically this is like steady_clock, but they can do better.
|
# ? Oct 8, 2021 19:54 |
|
I checked LLVMs implementation of steady_clock and all it does is call the system monotonic clock functions - the same ones Rust uses, and found often aren't actually monotonic AFAICT the only difference is that Rusts version has a hard guarantee of being monotonic, even if the system implementation is broken, but the C++ version takes the systems "guarantee" of monotonicity at face value repiv fucked around with this message at 20:19 on Oct 8, 2021 |
# ? Oct 8, 2021 20:09 |
|
That's C++ for you.
|
# ? Oct 8, 2021 21:00 |
|
I like the C++ way. I also like to see the world burn, no relation.
|
# ? Oct 8, 2021 22:15 |
|
repiv posted:I checked LLVMs implementation of steady_clock and all it does is call the system monotonic clock functions - the same ones Rust uses, and found often aren't actually monotonic To be honest, to me that looks the correct approach. If the OS is not capable of doing its job (return an always increasing counter) then just file a bug against the OS. Or against the CPU. Rust seems to be going above and beyond of what an userspace application should be doing.
|
# ? Oct 8, 2021 22:17 |
|
Yeah I agree with that, but at the same time who has never said "let's at least implement a workaround on our end"? It's just weird to have the compiler fix this instead of implementing a library with the workaround function
|
# ? Oct 8, 2021 23:31 |
|
"file a bug against the CPU" how'd that work out for u
|
# ? Oct 8, 2021 23:35 |
|
JawnV6 posted:"file a bug against the CPU" It did work the once...
|
# ? Oct 9, 2021 00:34 |
|
Tei posted:I like the C++ way. This is a loving pro tier post, just outstanding
|
# ? Oct 9, 2021 00:38 |
|
aha whoops, not supposed to talk about them
|
# ? Oct 9, 2021 00:42 |
|
QuarkJets posted:Yeah I agree with that, but at the same time who has never said "let's at least implement a workaround on our end"? Yeah, especially for something like this which keeps coming up across multiple OSes and CPU architectures, and it's difficult to validate whether or not the issue has actually been 100% fixed. In one of those issues a user reported Windows taking two weeks to hit the bug. Apparently Firefox has basically the same hack because they also kept running into monotonic timers going backwards.
|
# ? Oct 9, 2021 03:07 |
|
repiv posted:Yeah, especially for something like this which keeps coming up across multiple OSes and CPU architectures, and it's difficult to validate whether or not the issue has actually been 100% fixed. In one of those issues a user reported Windows taking two weeks to hit the bug. Interestingly Chrome's implementation doesn't seem to have any hacks on POSIX[1], Mac (...or Fuchsia, but whatever), though the Windows one is pretty complex: https://source.chromium.org/chromium/chromium/src/+/main:base/time/time_win.cc;drc=7b376aa2d32f7acac47aa7edbc50849f6b229e86;l=541 [1] https://source.chromium.org/chromium/chromium/src/+/main:base/time/time_now_posix.cc;drc=7b376aa2d32f7acac47aa7edbc50849f6b229e86;l=99
|
# ? Oct 9, 2021 05:17 |
|
It looks to me like that isn't about ensuring monotonicity. It's switching the timer source it uses if there is no high resolution timer hardware, or when it suspects that the windows HAL is using a non-processor TSC source (vista or modern windows when there are large numbers of cpus) because it'd rather have a faster call to a lower resolution/higher battery life timer. The posix one is just system monotonic clock always, die if it's not available
|
# ? Oct 9, 2021 06:23 |
|
QuarkJets posted:Yeah I agree with that, but at the same time who has never said "let's at least implement a workaround on our end"? It's just weird to have the compiler fix this instead of implementing a library with the workaround function I don’t think anyone’s fixing this in the compiler. The rust code here is in a library — one that comes with the standard distribution iiuc, but still, a library. And the LLVM implementation somebody was talking about is presumably in the libc++ library, not the compiler framework.
|
# ? Oct 9, 2021 06:47 |
|
Timekeeping was a mistake.
|
# ? Oct 9, 2021 21:06 |
|
only if you ask... Nicely
|
# ? Oct 10, 2021 19:35 |
|
omeg posted:Timekeeping was a mistake. Yea! the brain don't seems to need a clock to function, every part is working has fast (or slow) as it want to work and somehow getting results. maybe is time we start building clockless hardware, with semaphores or queues or some poo poo instead of clocks and if anyone want to store a date in a database, we just punch him in the face Edit: this is a silly joke, clocks make everything easier Tei fucked around with this message at 07:30 on Oct 11, 2021 |
# ? Oct 10, 2021 22:43 |
|
Clockless hardware exists. Famously you have Chuck Moore from Forth game designing some http://www.greenarraychips.com/ Arguably you could make dataflow processor architectures that are purely transport triggered, but I don't think that has been explored yet.
|
# ? Oct 11, 2021 09:03 |
|
Clockless chips are like holographic storage, for multiple decades there have been periodic articles talking about how amazing it's going to be, but it's never really happened.
|
# ? Oct 11, 2021 09:23 |
|
Qwertycoatl posted:Clockless chips are like holographic storage, for multiple decades there have been periodic articles talking about how amazing it's going to be, but it's never really happened. I remember when they were talking about holographic cards being a rewritable blu-ray competitor in the mid-2000s and it seemed like a far fetched idea that was way more Star Trek than realistic tech. A whopping 30 gigs on a single magic plastic card! Well, now you can get a 32 GB USB drive with a ten dollar bill and still have enough change left over for a Costco hot dog, and I still don't have a pocket full of isolinear chips.
|
# ? Oct 11, 2021 09:38 |
|
Tei posted:Yea! Technically correct, apparently https://www.scientificamerican.com/article/your-brain-has-two-clocks/
|
# ? Oct 11, 2021 10:06 |
|
https://twitter.com/Cor3ntin/status/1361105117303476224 two hours of build time spent instantiating std::unique_ptr?
|
# ? Oct 11, 2021 11:40 |
|
repiv posted:https://twitter.com/Cor3ntin/status/1361105117303476224 How many unique pointers could you possibly need or want?
|
# ? Oct 11, 2021 12:00 |
|
The combined cost of std::unique_ptr being very flexible and smart type, and having to instantiate templates in each separate TU. I moved to a custom unique_ptr-like type that has none of the smart parts, and for my project it took 20% off compilation times. (I also made it trivial-abi type under Clang)
|
# ? Oct 11, 2021 12:25 |
|
I am waiting for Go++.
|
# ? Oct 11, 2021 12:32 |
|
champagne posting posted:How many unique pointers could you possibly need or want? This is my pointer. There are many like it, but this one is mine. e: That's what I like about C++. My computer gets faster, but my compiles still take an age.
|
# ? Oct 11, 2021 12:40 |
|
ynohtna posted:This is my pointer. There are many like it, but this one is mine. this is still vastly preferable to the world of "but everything keeps running slower anyway" we seem to be heading towards. everything is lovely javascripts now and you need 300 megs of ram and 50 million clock cycles to display a line of text lmao.
|
# ? Oct 11, 2021 12:56 |
|
champagne posting posted:How many unique pointers could you possibly need or want? 2704612, apparently
|
# ? Oct 11, 2021 13:13 |
|
I got a 3900X (24 threads) for compiling C++ code and I did not regret it lol
|
# ? Oct 11, 2021 16:12 |
|
https://twitter.com/woketopus/status/1447150924846313475
|
# ? Oct 11, 2021 19:31 |
|
Fortunaly PHP has escaped his creators and are in the hands of other people that know more than the original author. Unfortunaly PHP has no real identity, just copy what seems to work. It started with inspiration from Perl and Python, and C and C++, and now is trying to recreate Java, but worse. I wish the maintainers had ideas of their own that where worth following to make the language a better PHP, with solid fundations and principles. But at least is now in the hands of competent people, I believe. PHP as is now, in 2021, is a language that will hit you in the face you with a rolled newspaper if you try to go too clever with things like lambda functions. Like if the language is trying to tell you "Please write simple tame code that *everybody* can understand". But I think thats somewhat a low bar that need to be raised, more than enforced.
|
# ? Oct 11, 2021 19:59 |
|
Coding Horrors: I still don't find programming enjoyable
|
# ? Oct 11, 2021 20:16 |
|
This is my favourite thing about php
|
# ? Oct 11, 2021 20:27 |
|
That one is a classic. Should I spend 5 minutes implementing actual hash function? No, let's just mangle all names to have a nice length distribution.
|
# ? Oct 12, 2021 07:06 |
|
If worse is better, then PHP is best.
|
# ? Oct 12, 2021 12:42 |
|
Tei posted:just copy what seems to work. Disgraceful! Unheard-of in programming! A recipe for failure.
|
# ? Oct 13, 2021 00:36 |
|
|
# ? Jun 7, 2024 03:41 |
|
Doom Mathematic posted:Disgraceful! Unheard-of in programming! A recipe for failure. Cargo culting is not a recipe for failure. Its just mediocre with mediocre results. And we are talking about a programming language. Is better if is made following a idea, so is easier to learn and remember.
|
# ? Oct 13, 2021 07:38 |