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

Reworked the internal of this library. #1

Open
wants to merge 7 commits into
base: master
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
Cargo.lock
.idea/
16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[package]
name = "smallset"
version = "0.1.1"
authors = ["Chris Fallin <cfallin@c1f.net>"]
description = "An unordered set of elements optimized for small sizes"
repository = "https://github.com/cfallin/rust-smallset"
documentation = "https://cfallin.github.io/rust-smallset/smallset/"
name = "smolset"
version = "1.1.0"
authors = ["Chris Fallin <cfallin@c1f.net>", "Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>"]
description = """"
An unordered set of elements optimized for small sizes.
This is a fork of the original library with overhauled internals, better fallback perforamance (O(1) insert and find) and more features!
"""
repository = "https://github.com/hbina/smolset"
license = "MIT"

[dependencies]
smallvec = "0.1"
smallvec = "1.4.2"
31 changes: 13 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
`smallset`: a small unordered set
=================================
# SmolSet

[![Build Status](https://travis-ci.org/cfallin/boolean_expression.svg?branch=master)](https://travis-ci.org/cfallin/rust-smallset)
[![Crate](https://img.shields.io/crates/v/smolset.svg)](https://crates.io/crates/smolset)

[crates.io](https://crates.io/crates/smallset/)
This crate implements a small unordered-set data structure implemented using
[smallvec](https://crates.io/crates/smallvec/).
It initially stores set elements in a simple unordered array.
When the set is smaller than a parameterizable size, no allocations will be performed.
The data structure is thus very space-efficient for sets of only a few elements, much more so than a tree-based or hash-table-based set data structure.
It is also fast when the set is small: queries and inserts perform a linear scan, which is more cache-friendly than a pointer-chasing search through a tree.

[Documentation](https://cfallin.github.io/rust-smallset/smallset/)
However, as the set grows, it will transform internally into a `std::collections::HashSet`.

This crate implements a small unordered-set data structure implemented using
[smallvec](https://crates.io/crates/smallvec/). It stores set elements in a
simple unordered array, and when the set is smaller than a parameterizable
size, the elements are stored completely inline (i.e., with zero heap
allocations). The data structure is thus very space-efficient for sets of only
a few elements, much more so than a tree-based or hash-table-based set data
structure. It is also fast when the set is small: queries and inserts perform
a linear scan, which is more cache-friendly than a pointer-chasing search
through a tree.

`smallset` should be used where minimizing heap allocations is of primary
importance and where it is expected that no more than a few elements will be
present. If the set grows large, then it will exhibit poor (`O(n)` queries and
inserts) performance.
## Note

This is a fork of the original library here: [rust-smallset](https://github.com/cfallin/rust-smallset).
I have rewritten the internals completely to not have such a bad fallback mode and added more features (and their tests and documentations).