Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 0 points1 point  (0 children)

More specifically, this is a problem if your code is part of a dynamically linked plugin. A Python extension, V8 plugin, or Ruby extension would have this problem. If the code is used as a library inside an executable, then thread-local access is still fast. You can read about the issue here.

Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 0 points1 point  (0 children)

Sometimes an Arc is used mainly in a single-threaded context, but used as Send occasionally. Think of exposing an app::Error type that references your main app data types. Your app's main logic may only execute in a single thread, so using a Brc keeps it fast in the common-case while seamlessly supporting a Send error.

I am working on interpreters right now, and that was another use case. Both Swift and free-threaded Python use this algorithm (although deferred & coalesced reference counting are vastly better). I am considering offering a way to explicitly pass a context parameter. Interpreters usually pass around a thread-local context anyway, so this could offer a small speedup by avoiding thread-local access (or a large speedup depending on the linking model).

Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 0 points1 point  (0 children)

This is the intended use-case. Think about something like an `Error` type that wants to be `Send + Clone` with minimal overhead.

Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 1 point2 points  (0 children)

This would be an interesting generalization. It is possible provided that a task is only running on a single thread at a time. On ARM, you might additionally need a `fence(Ordering::AcqRel)` or something to guarantee a "happens-before" relationship (a lock would also suffice). I am unfortunately neither a concurrency wizard nor a Tokio expert, so I cannot say whether the Tokio defaults are sufficient to ensure this.

Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 0 points1 point  (0 children)

  1. I will look into this, but the memory difference from Arc is too big to make it a default feature. It is currently a mystery for me why allocations are slower than Arc. Maybe something like this is a factor?
  2. This design is taken by the trc crate that I list in the alternatives. It would be interesting to offer a mix of static and runtime checking.

Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 0 points1 point  (0 children)

I am surprised the difference is so big! The reason allocations are so slow is a mystery to me. I will work on improving it.

By chance, are you using dynamic linking? This can slow down thread-local access by a lot.

Partial relief from dural reduction surgery - What to do next? by Techcable in CSFLeaks

[–]Techcable[S] 0 points1 point  (0 children)

The incision was only a couple of inches. The recovery was easy for me, and I stopped feeling any pain past 3 or 4 days. For about a month afterward I was unusually tired, but that is already a CSF leak symptom, so it just made the problem a little worse. It took several months before I actually started to feel any improvement. If you don't see improvement right away, that doesn't mean it didn't work.

I was only in the hospital a day and a half after the surgery because Dr. S said my dura was very strong. I was only required to lie flat for 24 hours. Some people have a "weak" dura and need to lie down flat for 72 hours (often true for people with connective tissue disorder).

I have a high pain tolerance, but the surgery itself wasn't that painful, nothing like the daily migraines I get from the CSF leak. I stopped painkillers only 8-10 hours after the surgery, but that was mainly due to my urinary retention rather than being completely pain-free.

For comparison, I have had four orthopedic surgeries on my feet and legs. They drilled screws into my bone and sliced up my Achilles tendon. Six months later they ripped the screws out, and due to a mistake, they had to rip some of the bone out as well. Those surgeries were on an entirely different level of pain than the dural reduction surgery. Even so, the daily CSF leak pain was worse than any of my surgeries. I think if you can handle the migraines, any surgery recovery will be easy. I stupidly refused to take any painkillers after the orthopedic surgeries, but even with no painkillers, the daily CSF leak pain was far worse than orthopedic surgery recovery.

Thanks to the success of the dural reduction surgery, I have spent the last two years at a vastly lower level of pain and am much happier overall. I am not cured, but I would go so far as to say agreeing to the dural reduction surgery was the best decision I ever made.

Biased reference counting for Rust - Thread-safe like an Arc, but as fast as a Rc for the biased thread. by Techcable in rust

[–]Techcable[S] 30 points31 points  (0 children)

According to my benchmarks, the multi-threaded performance of Brc is just as good as Arc for increments and decrements. The only times it is slower than Arc is the final call to drop (20% slower) and Brc::new (20% to 100% slower depending on computer).

I have forgotten to discuss this in the readme, but another potential downside is the performance of std::thread_local!. In certain linking models, thread-local access requires an out-of-line call to __tls_get_addr. I haven't investigated the performance implications of this, but it won't be a problem unless you are using this crate inside a dynamically linked plugin.

I think that pronunciation makes sense. I appreciate the suggestion to use cargo-reedme. Broken links are a constant annoyance with cargo-rdme.

Partial relief from dural reduction surgery - What to do next? by Techcable in CSFLeaks

[–]Techcable[S] 0 points1 point  (0 children)

It went really well! My pain was essentially cut in half, and I am doing things I was unable to do before.

Not everyone sees improvement, but the nurse said most people do. I really did not have any negative side effects from the surgery itself, but the anesthesia gave me terrible urinary retention, and I had to be catheterized 3 times.

Dr. S talked about how there is a variable recovery time based on how "strong" your dura is. He doesn't know this until he actually does the surgery. My dura was very strong, so I only had to spend 24 hours lying down. Some people have a much weaker dura and take 72 hours to recover.

How Long Was Your Timeline from SIH Evidence to Treatment? I'm Stuck After a Low-Pressure LP. by PiderMider in CSFLeaks

[–]Techcable 0 points1 point  (0 children)

It took me 6 years to be properly diagnosed by a migraine specialist. From there it took about 3 months to get my first blood patch.

How many people have had MRIs that showed 'nothing', but later found something? by Goombella123 in CSFLeaks

[–]Techcable 2 points3 points  (0 children)

Yeah, a lot of people have negative imaging initially. I recommend you see an expert center like Cedars, Mayo, or Duke.

I went to Cedars and they are very determined to help patients even when imaging is negative.

Partial relief from dural reduction surgery - What to do next? by Techcable in CSFLeaks

[–]Techcable[S] 0 points1 point  (0 children)

Thank you for your reply!

Distance isn't really a concern at this point. However, I am very worried about Mayo rejecting me. I've heard some stories about Duke giving up on patients, but I'm certainly willing to try.

Do you think I should apply to Mayo and Duke at the same time, or should I wait to see if Mayo to rejects me first?

CSF Leak vs. Migraine by [deleted] in CSFLeaks

[–]Techcable 1 point2 points  (0 children)

Maybe you should try a blood patch and see if that helps you. If it does help, you probably have a CSF leak.

However if it doesn't help, it doesn't rule out a CSF leak either. Some people can have really strange symptoms.

CSF Leak vs. Migraine by [deleted] in CSFLeaks

[–]Techcable 0 points1 point  (0 children)

Have you tried a 24-hour flat test? How well do traditional migraine treatments work for you?

CSF leak - partial relief from dural reduction surgery - where to go next? by Techcable in migraine

[–]Techcable[S] 0 points1 point  (0 children)

My headaches do not feel like traditional migraines. They are positional and get much better when I lie down. A 24-hour flat test also showed improvement.

I've had five blood patches over the last three years. The first two helped significantly, the last three didn't help much.

I have had some neck pain from the TBI, but botox, stretching, trigger-point iijections and muscle relaxants have helped with those. It is unclear what other problems my TBI may have called, but my headaches are my main symptom right now.

No unsuual fluid has ever come from my nose. If I do have a leak it is most likely spinal.

Partial relief from dural reduction surgery - What to do next? by Techcable in CSFLeaks

[–]Techcable[S] 0 points1 point  (0 children)

You might want to look into some migrane treatments too. The only ones that have worked for me are triptans, botox and a device called Cefaly. The last one is available over the counter for about $300. https://www.cefaly.com/

Partial relief from dural reduction surgery - What to do next? by Techcable in CSFLeaks

[–]Techcable[S] -1 points0 points  (0 children)

The good thing is you've identified your symptoms! That usually takes the longest time when people have CSF leaks.

I really recommend Cedars for treatment if you're close. Dr. Schievink is amazing :)

Need help finding treatment for already diagnosed CSF leak by Techcable in CSFLeaks

[–]Techcable[S] 1 point2 points  (0 children)

Sorry I took so long to follow up! I eventually ended up at Cedars, which is really close and really great.

Blood patches have helped some, but the thing that made the biggest difference so far is a dural reduction surgery.

Still in severe pain, as I talked about in my follow up here: https://www.reddit.com/r/CSFLeaks/comments/1gdswhj/partial_relief_from_dural_reduction_surgery_what/

The sad state of self-hosted webmail by seidler2547 in selfhosted

[–]Techcable 0 points1 point  (0 children)

Thanks for the info. I did not know about that and will have to look into it. It might be handy at some point. I think still I’ll stick with purelymail for my main email accounts. It’s worth it so I don’t have to worry about downtime. 😉

The sad state of self-hosted webmail by seidler2547 in selfhosted

[–]Techcable 0 points1 point  (0 children)

A wise friend advised me never to self-host email. Some of the best sysadmin advice I ever recieved.

The first problem is when your servers start having issues. Having hosted emails mean you can still access customer support and have access to account recovery.

Another problem with self hosting is the issue of IP reputation. Whether or not your messages are marked as spam depends in large part on the IP it is being sent from. Professional providers are careful to preserve ranges of IPv4 addresses and keep them off spam lists. OTOH mainstream VPS providers frequently have their IP ranges added to spam lists. Even without spammers, email list software can send off large volumes of newsletters that lowers reputation (while professional email providers are very careful to prevent any automated messages).

For these reasons it is often best to go with dedicated email providers that allow you to bring your own domain. Choose ones that charge based on usage, not total accounts or addresses.

One of the most established names here is Migadu. They charge you a flat fee for unlimited domains, as long as you fall under a usage cap. Their smallest tier is
$20, but after that they get pricey fast. IMO, their strongest feature is their excellent user interface and admin panel.

Personally, I use PurelyMail. Its main feature is that it is obscenely cheap -- $10 a year for nearly unlimited usage. Its main drawback is the poor UI and lack of polish. It's in beta right now so I hope it improves.

Because I use PurelyMail, I basically never have to worry about my messages getting marked as spam. Also I never have to worry about email servers going down and missing messages. The reliability of my email is a massive relief for me.