2023-03-22
2084
#rust
Yashodhan Joshi
163607
109
Mar 22, 2023 â‹… 7 min read

Using Cow in Rust for efficient memory utilization

Yashodhan Joshi I am a student interested in physics and systems programming currently exploring Rust and operating systems. I am also passionate about helping others learn.

Recent posts:

Building A Multi-Lingual Web App With Nuxt 3 And Nuxt i18n

Building a multi-lingual web app with Nuxt 3 and Nuxt i18n

Create a multi-lingual web application using Nuxt 3 and the Nuxt i18n and Nuxt i18n Micro modules.

Emmanuel John
Dec 30, 2024 â‹… 9 min read
Styling HTML Details and Summary With Modern CSS

Styling HTML <details> and <summary> with modern CSS

Use CSS to style and manage disclosure widgets, which are the HTML `details` and `summary` elements.

Rob O'Leary
Dec 26, 2024 â‹… 11 min read
react native's new architecture: sync and async rendering

React Native’s New Architecture: Sync and async rendering

React Native’s New Architecture offers significant performance advantages. In this article, you’ll explore synchronous and asynchronous rendering in React Native through practical use cases.

Emmanuel John
Dec 24, 2024 â‹… 8 min read
Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
View all posts

3 Replies to "Using Cow in Rust for efficient memory utilization"

  1. I really enjoyed your post. It really helped understand the problem well.
    I think there is a small bug, it doesn’t distract much from the value of the post, but it’s always nice if the code works. The first example is missing `seen_ids.insert(element.id.clone());`, or something of the sort when looping through the list to track if an id has been seen. The second code snippet has the HashSet insert.

    1. Hey Marc, thanks a lot for noticing and reporting this! The first example was initially supposed to be just a pseudo-code / algorithm, and then the proper code was supposed to be the second snippet. However, While writing and re-writing, I slipped in some code in the first, and the final version had the missing code line that you noticed. In any case I should have taken more care.
      Thanks a lot for commenting this, I have fixed the error now. Hope you found this post useful and fun to read!

  2. Consider a search and replace program that searches for a particular text and if found, replaces it with another text in a UTF-8 encoded text file. Most of the time, the text file contains none or only a few occurrences of the search text. As the program parses each line in the text file, only if the search text is found, that line should be mutated. Otherwise no need to mutate that line. Cow is perfectly suitable for this use case.

Leave a Reply