no comments (yet)

sorted by: hot top controversial new old
there doesn't seem to be anything here
68 comments in c/linux@lemmy.ml view that post
[–] 99 points 1 month ago* (last edited 1 month ago) (16 children)

Title is a bit misleading, and I think intentionally, which kinda irks me. It isn't a 400x speedup of RAM by means of compression. If I understood correctly, it's 400x speedup compared to disk read for swap.

Please correct me if I'm wrong here. I'd love some positive news from the IT world that isn't depressive. (edit: I implied this wasn't. It is. I'm just not sure of the actual impact)

  • source
  • hideshow 16 child comments
  • [–] 107 points 1 month ago (7 children)

    It's a little better than your read. The ~400x speedup is in comparison to using ZRAM, which, in very brief terms, compresses memory by creating an in-memory compressed block device and assigning that as your swap space. So your "swap" is actually a compressed chunk of RAM, not on disk.

    This was significantly slower than normal memory access because page faulting when looking up something in memory then fetching from swap was, itself, expensive. Regardless of how fast that swap was. When your swap is on a storage device that overhead is comparatively tiny, but when it's just another chunk of memory suddenly it's what you're spending most of your time on.

  • source
  • parent
  • hideshow 7 child comments
  • [–] 15 points 1 month ago (6 children)

    Fuck yea, RAM swap? I bought both my laptop and desktop when RAM was cheap, and got more memory than I needed. I can safely allocate like 12GB to CRAM!

  • source
  • parent
  • hideshow 6 child comments
  • [–] 36 points 1 month ago (4 children)

    The win from CRAM is that it is not swap, and operates using mostly normal RAM semantics. If it works as advertised you should be able to allocate most (all?!) of your RAM as CRAM.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 1 month ago (3 children)

    I would guess this is only useful in servers, as for day to day use you ideally want the lowest latency you can for responsiveness. That said, if there's a way you can specify which type processes can use, that may be useful in some cases

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 1 month ago*

    Honestly though CPU processing is going to add almost no latency at all.

    Almost all latency is sending to the RAM itself, so if you can compress it in a CPU cache before sending it, its nearly free RAM space.

    Also systems are fucked fast these days you could probably make something responsive in pure python - other than millisecond timing scenarios like medical and audio stuff

  • source
  • parent
  • [–] 24 points 1 month ago (6 children)

    I'm not sure if this is misleading at all. If anything, they should have mentioned compared to ZRAM. Title is incomplete, but I don't think it is intentionally misleading here. It just looks like they expect the reader to know CRAM is a replacement for ZRAM. The new compression method CRAM with over 400x speedup is compared to ZRAM method:

    A new compression model, called CRAM, offers a different path to compression that avoids swap entirely by keeping the compressed data in memory, and it offers up to 452x the performance of ZRAM.

    Because CRAM is stored in RAM and treated as RAM, with full cacheline/byte access, it can be accessed in a read-only fashion with little delay; just the cost of hardware-offloaded compression. As a result, CRAM "runs at DRAM speed," as the creator says in the slide above. While the graph already looks impressive, it's a logarithmic scale; CRAM, in the worst case, is doing 489 million operations per second versus ZRAM's 1.1 million. It's barely comparable.

    Even when you enable writes, CRAM is still much faster than ZRAM; 5.4x in the worst tested case of 20% writes. That's a huge drop from the 452x read-only case, but keep your context; a 5.4x speedup is still titanic.

    Is writes enabled CRAM / ZRAM common? If so, then the post title is definitely misleading.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 3 points 1 month ago* (5 children)

    Yeah wait how would you have read only RAM?

    Loaded on boot for the OS I suppose?

    Probably nice for running TV boxes off even less RAM than they're already starved for lmao

  • source
  • parent
  • hideshow 5 child comments
  • [–] 1 point 1 month ago* (4 children)

    Guess read only RAM becomes... ROM? :D I have no clue either. Maybe there are protected areas in the memory no program has write access to, so it is read only from perspective of the application. Searching the web doesn't help, because every link I clicked just explains the difference between ROM and RAM.

    Hmm... when I think about Rust programming (which is true in C too probably), there are two types of locations our variables can assigned to: Stack and Heap. In example if you have a text string as a literal like "Version 1.0", that string is located in the Stack memory, because it is unchanging. The Heap gets all those content that can vary and arbitrary long, but its slower. So the Stack content is much smaller, faster and basically read only RAM area (if I understand this correctly). Maybe that is it?

  • source
  • parent
  • hideshow 4 child comments
  • [–] 1 point 1 month ago* (3 children)

    I'm drawing on some old memories here, so I could be mistaken, but I don't think the stack is read only, not in C anyway or in the underlying machine code. If it is faster it has to do with greater overhead needed managing the larger heap and perhaps being more efficient to push and pop with small offsets to a local stack frame vs large absolute addresses.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 1 month ago* (2 children)

    but I don’t think the stack is read only

    I don't mean the stack is read only (edit: yes I meant that in my previous reply, but got confused myself, I actually never thought the entire stack being read only, I was only thinking about those specific variables and literal strings, sorry for confusion), but certain variables holding values that are only used to read and not change. In example you cannot change literals, therefore they are read only values. In example if you have a program that prints "Hello Lemmy", that string is a literal that cannot be altered, and it is found in the application itself, as part of the binary. That part maybe is marked as read only?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 month ago (1 child)

    Right, a stack that was itself read-only would be hard to use! :^D C definitely lets you modify the things in the stack. (Ah the fun of bugs where you accidentally overwrite other shit on the stack!) I don't know Rust, but it would not surprise me if Rust only had immutable things on the stack.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 month ago

    No, its not only immutable things on the stack. I mean if you include a literal constant string such as "MIT LICENSE", that is part of the compiled binary file. So it is unchangeable. Because you cannot change a literal, a "1" is always a "1" in the compiled binary file. And those are basically read only by their nature and loaded into the stack. I think or guess in C it is the same. Or any language for that matter.

    I started to think I was hallucinating. I guess what I was thinking is this part https://en.wikipedia.org/wiki/Data_segment . There are read-only data segments too.

  • source
  • parent
  • [–] 11 points 1 month ago* (last edited 1 month ago)

    Let me use my Raspberry Pi 3b as a practical example of what @vithigar@lemmy.ca was explaining. I run PiHole + Unbound on the Raspberry Pi 3b, with 1GB of ram. The main killer for a little Pi 3b is reading and writing to the SD card. We want to avoid that as much as possible. Block lists get updated weekly, so that's no big deal, but there is still a lot of traffic information that is being kept track of. The solution is to load all of that into zram. As you can imagine, on a slow and resource constrained system like a Pi 3b, any performance enhancement has a huge impact. A 452x performance increase over ZRAM on a system that mostly lives on ZRAM is massive.

    I am not entirely sure about this but I imagine that this is also massive news for live operating systems like Tails and Kali Live.

  • source
  • parent
  • [–] 85 points 1 month ago

    Finally! I can download more RAM!

  • source
  • [–] 81 points 1 month ago (16 children)

    So there are some benefits to the ram crisis? People actually optimize things because of limited resources.

  • source
  • hideshow 16 child comments
  • [–] 43 points 1 month ago

    When I was in computer science in college back in the 1900s, they told us that the USSR was responsible for some of the best algorithms still in use at the time (both for RAM and CPU usage) because they just had less to work with.

    Guess we're all in that boat now.

  • source
  • parent
  • [–] 35 points 1 month ago (5 children)

    You know it's getting weird out there when Meta seems to be doing something that's actually useful.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 7 points 1 month ago* (last edited 1 month ago)

    Whenever big tech companies like Meta do useful things like support Overture Maps Foundation (which is also supported by Microsoft and Amazon) they are doing it to blunt some competitive advantage another tech company has, such as google in this case. They support open source insofar as they can't monetize whatever they are open sourcing.

  • source
  • parent
  • [–] 6 points 1 month ago (5 children)

    Does it count as optimization? For supported hardware, it's certainly cool. But it's not making inefficient software better, it's making better use of the hardware.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 4 points 1 month ago (4 children)

    So using the back of a knife to cut something is not more efficient than using the sharp side? I would say making better use of hardware is also an efficiency gain. You use the same hardware to do more, while not driving up cost significantly. That is efficiency in my book.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 1 point 1 month ago (3 children)

    It's not using the same hardware, this seems to use a special compression chip.

    To me this feels more like the benefits of a CPU or GPU upgrade. Things run faster, but not due to software improvements. When people talk about things getting optimized due to the high RAM prices, I think most people are referring to software improvements.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 1 month ago (2 children)

    There is no mention of any extra hardware here though. The article even suggests this to benefit existing hardware like the steam deck.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 month ago (1 child)

    In another comment, I posted a link to the CRAM presentation that mentioned a chip.

    This article also mentions some hardware:

    Because CRAM is stored in RAM and treated as RAM, with full cacheline/byte access, it can be accessed in a read-only fashion with little delay; just the cost of hardware-offloaded compression.

    I don't think it would say that if they meant the CPU was doing the compression.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 month ago

    Ah I see. It might not be a requirement though. In the case that the numbers are given with hardware offloaded compression it might just be slower when running on CPU. But I guess time will tell.

  • source
  • parent
  • [–] 154 points 1 month ago (4 children)

    Ram compression called CRAM? I'm sold

  • source
  • hideshow 4 child comments
  • [–] 43 points 1 month ago (6 children)

    Wait I think I've already been here

  • source
  • hideshow 6 child comments
  • [–] 2 points 1 month ago (1 child)

    And I was remembering Drivespace and Stacker.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 month ago*

    Ya, but those worked. Wasn't it originally called Disk Doubler (think it might have changed names when MS purchased it).

    I remember finding a bug in it that took forever to figure out. You had to install windows 3.1 before enabling it or it would fail to read one of the floppies.

    Took me a LONG time to figure that one out....

  • source
  • parent
  • [–] 24 points 1 month ago (2 children)

    Aww yeah! Time to CRAM some memory!

  • source
  • hideshow 2 child comments
  • [–] 21 points 1 month ago (2 children)

    This idea comes out of the woodwork ever time RAM gets expensive.

  • source
  • hideshow 2 child comments
  • [–] 20 points 1 month ago

    Ah, the old download more RAM trick. An oldie but a goodie.

  • source
  • [–] 35 points 1 month ago (1 child)

    CRAM is an utterly goated name

  • source
  • hideshow 1 child comment
  • [–] 17 points 1 month ago (1 child)

    meh needs special hardware

  • source
  • hideshow 1 child comment
  • [–] 14 points 1 month ago

    Too bad, this isn't happening as a kernel patch. Adding to that point:

    The key detail is that CRAM is a hardware implementation of compression, meaning the logic is in the memory controller rather than in software, so it's not a pure software trick like ZRAM. However, it uses standard off-the-shelf DRAM and a normal memory bus, so no exotic modules or custom interfaces are required.

  • source
  • parent
  • [–] 13 points 1 month ago

    I can carry nearly 80 gigs of data in my head. One sixty if l use a doubler.

  • source
  • [–] 8 points 1 month ago

    With great speed comes great accuracy and endurance?

  • source
  • [–] 8 points 1 month ago (2 children)
  • [–] 4 points 1 month ago (1 child)

    I was dabbling in pricing a Slimbook last night and the price of RAM made me cry.

  • source
  • hideshow 1 child comment
  • [–] 4 points 1 month ago*

    But you need a CXL device which does the (de)compression in hardware between the CPU and RAM?

  • source
  • [–] 3 points 1 month ago

    So, from what i've got from the comments; instead of doing swap shenanigans except in RAM like ZRAM (which slows it down), it just compresses content to a separate portion of RAM and points there?

  • source
  • [–] 2 points 1 month ago
    [–] 2 points 1 month ago

    Aaaeh ya know, just use some lube or wd40 and cram it in there.

  • source