Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASIX support #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runiq"
version = "1.2.2" # remember to update html_root_url
version = "1.2.2" # remember to update html_root_url
authors = ["Isaac Whitfield <[email protected]>"]
description = "An efficient way to filter duplicate lines from input, à la uniq."
repository = "https://github.com/whitfin/runiq"
Expand All @@ -19,3 +19,6 @@ clap = { version = "3.1", features = ["derive"] }
fnv = "1.0"
scalable_bloom_filter = "0.1"
twox-hash = "1.6"

[patch.crates-io]
tokio = { git = "https://github.com/wasix-org/tokio", branch = "wasix-1.24.2" }
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# runiq

[![Crates.io](https://img.shields.io/crates/v/runiq.svg)](https://crates.io/crates/runiq) [![Build Status](https://img.shields.io/github/actions/workflow/status/whitfin/runiq/rust.yml)](https://github.com/whitfin/runiq/actions)

This project offers an efficient way (in both time and space) to filter duplicate entries (lines) from texual input. This project was born from [neek](https://github.com/whitfin/neek), but optimized for both speed and memory. Several filtering options are supported depending on your data and tradeoffs you wish to make between speed and memory usage. For a more detailed explanation, see the relevant [blog post](https://whitfin.io/filtering-unique-logs-using-rust/).
Expand Down Expand Up @@ -41,14 +42,14 @@ this is another unique line

Here are some comparisons of `runiq` against other methods of filtering uniques:

| Tool | Flags | Time Taken | Peak Memory |
|-------|-----------|----------------|-----------------|
| neek | N/A | 55.8s | 313MB |
| sort | -u | 595s | 9.07GB |
| uq | N/A | 32.3s | 1.66GB |
| runiq | -f digest | **17.8s** | 64.6MB |
| runiq | -f naive | 26.3s | 1.62GB |
| runiq | -f bloom | 36.8s | **13MB** |
| Tool | Flags | Time Taken | Peak Memory |
| ----- | --------- | ---------- | ----------- |
| neek | N/A | 55.8s | 313MB |
| sort | -u | 595s | 9.07GB |
| uq | N/A | 32.3s | 1.66GB |
| runiq | -f digest | **17.8s** | 64.6MB |
| runiq | -f naive | 26.3s | 1.62GB |
| runiq | -f bloom | 36.8s | **13MB** |

The numbers above are based on filtering unique values out of the following file:

Expand All @@ -58,3 +59,23 @@ Line count: 5,784,383
Unique count: 2,715,727
Duplicates: 3,068,656
```

### Usage on WASIX

#### Compile the binary

```shell
$ cargo wasix build --release
```

> Note: create a test folder in the `target/wasm32-wasmer-wasi/release/test` and make the `input.txt` file

### running the binary

```
$ cd target/wasm32-wasmer-wasi/release
$ wasmer run runiq.wasm --mapdir=/test:test -- test/input.txt
this is a unique line
this is a duplicate line
this is another unique line
```