Skip to content

Commit

Permalink
Fix performance issues (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm authored Dec 17, 2024
1 parent cbd9fb1 commit de9e40b
Show file tree
Hide file tree
Showing 34 changed files with 581 additions and 1,312 deletions.
55 changes: 42 additions & 13 deletions .kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,15 @@ bytes@3.1.2:
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==

call-bind-apply-helpers@^1.0.0, call-bind-apply-helpers@^1.0.1:
call-bind-apply-helpers@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz#32e5892e6361b29b0b545ba6f7763378daca2840"
integrity sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==
dependencies:
es-errors "^1.3.0"
function-bind "^1.1.2"

call-bound@^1.0.2:
call-bound@^1.0.2, call-bound@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.3.tgz#41cfd032b593e39176a71533ab4f384aa04fd681"
integrity sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==
Expand Down Expand Up @@ -658,11 +658,11 @@ dom-serialize@^2.2.1:
void-elements "^2.0.0"

dunder-proto@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.0.tgz#c2fce098b3c8f8899554905f4377b6d85dabaa80"
integrity sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==
version "1.0.1"
resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a"
integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==
dependencies:
call-bind-apply-helpers "^1.0.0"
call-bind-apply-helpers "^1.0.1"
es-errors "^1.3.0"
gopd "^1.2.0"

Expand All @@ -672,9 +672,9 @@ ee-first@1.1.1:
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

electron-to-chromium@^1.5.73:
version "1.5.73"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.73.tgz#f32956ce40947fa3c8606726a96cd8fb5bb5f720"
integrity sha512-8wGNxG9tAG5KhGd3eeA0o6ixhiNdgr0DcHWm85XPCphwZgD1lIEoi6t3VERayWao7SF7AAZTw6oARGJeVjH8Kg==
version "1.5.74"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.74.tgz#cb886b504a6467e4c00bea3317edb38393c53413"
integrity sha512-ck3//9RC+6oss/1Bh9tiAVFy5vfSKbRHAFh7Z3/eTRkEqJeWgymloShB17Vg3Z4nmDNp35vAd1BZ6CMW4Wt6Iw==

emoji-regex@^8.0.0:
version "8.0.0"
Expand Down Expand Up @@ -716,11 +716,14 @@ enhanced-resolve@^5.13.0:
tapable "^2.2.0"

ent@~2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.1.tgz#68dc99a002f115792c26239baedaaea9e70c0ca2"
integrity sha512-QHuXVeZx9d+tIQAz/XztU0ZwZf2Agg9CcXcgE1rurqvdBeDBrpSwjl8/6XUqMg7tw2Y7uAdKb2sRv+bSEFqQ5A==
version "2.2.2"
resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.2.tgz#22a5ed2fd7ce0cbcff1d1474cf4909a44bdb6e85"
integrity sha512-kKvD1tO6BM+oK9HzCPpUdRb4vKFQY/FPTFmurMvh6LlN68VMrdj77w8yp51/kDbpkFOS9J8w5W6zIzgM2H8/hw==
dependencies:
call-bound "^1.0.3"
es-errors "^1.3.0"
punycode "^1.4.1"
safe-regex-test "^1.1.0"

envinfo@^7.7.3:
version "7.14.0"
Expand Down Expand Up @@ -976,11 +979,18 @@ has-flag@^4.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==

has-symbols@^1.1.0:
has-symbols@^1.0.3, has-symbols@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338"
integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==

has-tostringtag@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc"
integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==
dependencies:
has-symbols "^1.0.3"

hasown@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003"
Expand Down Expand Up @@ -1101,6 +1111,16 @@ is-plain-object@^2.0.4:
dependencies:
isobject "^3.0.1"

is-regex@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.2.1.tgz#76d70a3ed10ef9be48eb577887d74205bf0cad22"
integrity sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==
dependencies:
call-bound "^1.0.2"
gopd "^1.2.0"
has-tostringtag "^1.0.2"
hasown "^2.0.2"

is-unicode-supported@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
Expand Down Expand Up @@ -1614,6 +1634,15 @@ safe-buffer@^5.1.0:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==

safe-regex-test@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz#7f87dfb67a3150782eaaf18583ff5d1711ac10c1"
integrity sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==
dependencies:
call-bound "^1.0.2"
es-errors "^1.3.0"
is-regex "^1.2.1"

"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
Expand Down
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![badge-latest-release]][url-latest-release]

[![badge-kotlin]][url-kotlin]
[![badge-immutable]][url-immutable]

![badge-platform-android]
![badge-platform-jvm]
Expand Down Expand Up @@ -49,9 +48,6 @@ val base16 = Base16 {

// Use lowercase instead of uppercase characters when encoding
encodeToLowercase = true

// Use constant-time operations when encoding/decoding sensitive data
isConstantTime = true
}

// Shortcuts
Expand All @@ -66,7 +62,6 @@ Base16
val base32Crockford = Base32Crockford {
isLenient = true
encodeToLowercase = false
isConstantTime = true

// Insert hyphens every X characters of encoded output
hyphenInterval = 5
Expand All @@ -87,7 +82,6 @@ val base32Default = Base32Default {
isLenient = true
lineBreakInterval = 64
encodeToLowercase = true
isConstantTime = true

// Skip padding of the encoded output
padEncoded = false
Expand All @@ -101,7 +95,6 @@ val base32Hex = Base32Hex {
lineBreakInterval = 64
encodeToLowercase = false
padEncoded = true
isConstantTime = true
}

// Alternatively, use the static instance with its default settings
Expand All @@ -116,7 +109,6 @@ val base64 = Base64 {
lineBreakInterval = 64
encodeToUrlSafe = false
padEncoded = true
isConstantTime = true
}

// Alternatively, use the static instance with its default settings
Expand Down Expand Up @@ -204,8 +196,8 @@ file.outputStream().use { oStream ->
// automatically, which closes the `Encoder.Feed`
// and performs finalization of the operation (such as
// adding padding).
"Hello World!".forEach { c ->
feed.consume(c.code.toByte())
"Hello World!".encodeToByteArray().forEach { b ->
feed.consume(b)
}
}
}
Expand Down Expand Up @@ -313,7 +305,6 @@ dependencies {

<!-- TAG_DEPENDENCIES -->
[badge-kotlin]: https://img.shields.io/badge/kotlin-1.9.24-blue.svg?logo=kotlin
[badge-immutable]: https://img.shields.io/badge/immutable-0.1.4-blue.svg?style=flat

<!-- TAG_PLATFORMS -->
[badge-platform-android]: http://img.shields.io/badge/-android-6EDB8D.svg?style=flat
Expand All @@ -335,4 +326,3 @@ dependencies {
[url-latest-release]: https://github.com/05nelsonm/encoding/releases/latest
[url-license]: https://www.apache.org/licenses/LICENSE-2.0.txt
[url-kotlin]: https://kotlinlang.org
[url-immutable]: https://github.com/05nelsonm/immutable
1 change: 0 additions & 1 deletion benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ kmpConfiguration {
sourceSetMain {
dependencies {
implementation(libs.benchmark.runtime)
implementation(libs.immutable.collections)
implementation(project(":library:base16"))
implementation(project(":library:base32"))
implementation(project(":library:base64"))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ package io.matthewnelson.encoding.benchmarks

const val ENC_ITERATIONS_WARMUP = 5
const val ENC_ITERATIONS_MEASURE = 5
const val ENC_TIME_WARMUP = 1
const val ENC_TIME_WARMUP = 2
const val ENC_TIME_MEASURE = 3

const val TIME_QUICK = "quick-time"
const val TIME_CONST = "const-time"

This file was deleted.

Loading

0 comments on commit de9e40b

Please sign in to comment.