compaKTset is a small library aimed at providing you with the most memory efficient Set implementation for any particular data type of your choosing.

Related tags

Utility compaKTset
Overview

build-status

compaKTset is a small library aimed at providing you with the most memory efficient Set implementation for any particular data type of your choosing.

Currently supported and well-optimized types:

  • Int
  • Long
  • Double

Getting Started

<dependency>
    <groupId>me.beresnevgroupId>
    <artifactId>compaktsetartifactId>
    <version>0.1.1version>
    <dummy>unpublisheddummy>
dependency>

Example:

val intSet = newCompactSet<Int>(16)

val meaningAdded = intSet.add(42)
val containsSatan = intSet.contains(666)

Memory footprint

To understand how compact compaKTset really is, we can measure it's memory footprint and compare it with java.util.HashSet for various set sizes.

First, let's compare Int and Long with CompressedOops enabled

implementation / size 10^2 10^4 10^5 10^6
java.util.HashSet 5.9 KB 545 KB 5.8 MB 56.3 MB
CompactSet <1 KB 40 KB 0.4 MB 4 MB
10^2 10^4 10^5 10^6
java.util.HashSet 6.7 KB 625 KB 6.6 MB 64.3 MB
CompactSet <1 KB 80 KB 0.8 MB 8 MB

Now let's run it on the same VM, but with -XX:-UseCompressedOops

implementation / size 10^2 10^4 10^5 10^6
java.util.HashSet 9.3 KB 851 KB 9.2 MB 88.7 MB
CompactSet 4 KB 40 KB 0.4 MB 4 MB

For primitive types, memory saving is achieved mostly by getting rid of Entry elements (that come with headers and references) and storing elements in plain arrays.

Measurements were done using JOL, 64-bit HotSpot VM, OpenJDK11, Kotlin 1.5

Contributing

Project is built by gradle wrapper shipped in the repository

./gradlew clean build

Build requirements:

  • OpenJDK >11
You might also like...
Mi-FreeForm - An APP that is activated through Shizuku/Sui and can display most apps in the form of freeform
Mi-FreeForm - An APP that is activated through Shizuku/Sui and can display most apps in the form of freeform

Mi-FreeForm 简体中文 Mi-FreeForm is an APP that is activated through Shizuku/Sui and

Type safe intent building for services and activities

#IntentBuilder Type safe intent building for services and activities. IntentBuilder is a type safe way of creating intents and populating them with ex

Validator - Notify type based validation for input fields.
Validator - Notify type based validation for input fields.

Validator - Notify type based validation for input fields.

Simple-Keyboard - A quick lightweight keyboard app that helps chatting with your friends, or inserting any other texts, numbers or symbols KmmCaching - An application that illustrates fetching data from remote data source and caching it in local storage
KmmCaching - An application that illustrates fetching data from remote data source and caching it in local storage

An application that illustrates fetching data from remote data source and caching it in local storage for both IOS and Android platforms using Kotlin Multiplatform Mobile and SqlDelight.

A set of helper classes for using dagger 1 with Android components such as Applications, Activities, Fragments, BroadcastReceivers, and Services.

##fb-android-dagger A set of helper classes for using dagger with Android components such as Applications, Activities, Fragments, BroadcastReceivers,

A set of lint rules to check for common mistakes when styling and theming on Android
A set of lint rules to check for common mistakes when styling and theming on Android

A set of lint rules to check for common mistakes when styling and theming on Android

Matches incoming and/or outgoing text messages against set rules and sends them over to webhook.

Textmatic If you ever wanted a tool to simply push the SMS (or text messages) from your phone to somewhere remote, this is it. This app matches all in

KDoctor - A command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development

KDoctor is a command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development.

Releases(pre-0.1)
Owner
Ignat Beresnev
Ignat Beresnev
CreditCardHelper 🖊️ A Jetpack-Compose library providing useful credit card utilities such as card type recognition and TextField ViewTransformations

CreditCardHelper ??️ A Jetpack-Compose library providing useful credit card utilities such as card type recognition and TextField ViewTransformations

Stelios Papamichail 18 Dec 19, 2022
A small library which will save you from writing the same intent creation code again and again for the most simple tasks

Android Intents A small library which will save you from writing the same intent creation code again and again for the most simple tasks. I found myse

MarvinLabs 420 Nov 20, 2022
A beautiful set of predefined colors and a set of color methods to make your Android development life easier.

Colours is a port of the Colours Library for iOS made by my good friend Ben Gordon. You can find that project here. Installation Maven Central Colours

Matthew York 634 Dec 28, 2022
A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML

A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion.

null 603 Jan 1, 2023
Small Android library to help you incorporate MVP, Passive View and Presentation Model patterns in your app

DroidMVP About DroidMVP is a small Android library to help you incorporate the MVP pattern along with Passive View and Presentation Model (yes, those

Andrzej Chmielewski 225 Nov 29, 2022
Access and process various types of personal data in Android with a set of easy, uniform, and privacy-friendly APIs.

PrivacyStreams PrivacyStreams is an Android library for easy and privacy-friendly personal data access and processing. It offers a functional programm

null 269 Dec 1, 2022
A universal memory dumper using Frida

Fridump Fridump (v0.1) is an open source memory dumping tool, primarily aimed to penetration testers and developers. Fridump is using the Frida framew

null 547 Dec 22, 2022
A helper library to ease the most repetitive codes with simple reusable attributes.

ak-universal-android-helper A helper library to ease the most repetitive codes with simple reusable attributes. AKUAH can help you with many repetitiv

Aakash Kumar 20 Jul 8, 2020
Utility library that utilizes KSP to generate Room type converter classes.

Roomie Roomie is an annotation processing library that utilizes KSP to geaRoomie is an annotation processing library that utilizes KSP to generate TypeConverter classes for Room. TypeConverter classes most often involve same boiler-plate code and Roomie makes it really easy to quickly create them with a single annotation.nerate TypeConverter classes for Room. TypeConverter classes most often invol

Chukwuka Eze 12 Aug 26, 2022
The most comprehensive utils of ViewBinding.

ViewBinding reduces exceptions caused by id or type errors, which are recommended by both Google officials and Jake Wharton, but it can be a bit cumbersome to use, so this library can help you use ViewBinding with as little code as possible in any usage scenario.

DylanCai 667 Jan 5, 2023