Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhargav committed Dec 6, 2023
1 parent ca76ca9 commit 407f8e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
18 changes: 9 additions & 9 deletions benchmark/base_conversion_bench.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ASCIIConverterBenchmark extends CustomBenchmarkBase {

@override
void run() {
// 1335 ns/op
// 1326 ns/op
b(s);
}

Expand All @@ -57,7 +57,7 @@ class NonASCIIConverterBenchmark extends CustomBenchmarkBase {

@override
void run() {
// 1739 ns/op
// 1674 ns/op
b(s);
}

Expand All @@ -79,7 +79,7 @@ class IntegerLengthFactorConverterBenchmark1 extends CustomBenchmarkBase {

@override
void run() {
// 4625 ns/op
// 2609 ns/op
b(s);
}

Expand All @@ -101,7 +101,7 @@ class IntegerLengthFactorConverterBenchmark2 extends CustomBenchmarkBase {

@override
void run() {
// 1538 ns/op
// 922 ns/op
b(s);
}

Expand All @@ -123,7 +123,7 @@ class IntegerLengthFactorConverterBenchmark3 extends CustomBenchmarkBase {

@override
void run() {
// 1176 ns/op
// 1189 ns/op
b(s);
}

Expand All @@ -145,7 +145,7 @@ class NonIntegerLengthFactorConverterBenchmark1 extends CustomBenchmarkBase {

@override
void run() {
// 5090 ns/op
// 2978 ns/op
b(s);
}

Expand All @@ -167,7 +167,7 @@ class NonIntegerLengthFactorConverterBenchmark2 extends CustomBenchmarkBase {

@override
void run() {
// 4538 ns/op
// 2410 ns/op
b(s);
}

Expand All @@ -189,7 +189,7 @@ class NonIntegerLengthFactorConverterBenchmark3 extends CustomBenchmarkBase {

@override
void run() {
// 1165 ns/op
// 1188 ns/op
b(s);
}

Expand All @@ -211,7 +211,7 @@ class NonIntegerLengthFactorConverterBenchmark4 extends CustomBenchmarkBase {

@override
void run() {
// 1171 ns/op
// 1181 ns/op
b(s);
}

Expand Down
9 changes: 5 additions & 4 deletions lib/src/base_conversion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ class BaseConversion extends InvertibleFunction<String, String> {
}

return (sb.toString(), values.length);
} else if (_intLengthFactor == 0 ||
} else /*if (_intLengthFactor == 0 ||
values.length == 1 ||
(_intLengthFactor < 0 && _intLengthFactor + values.length <= 0)) {
(_intLengthFactor < 0 && _intLengthFactor + values.length <= 0))*/
{
// Horner's method
int remainder = 0;
final List<int> quotients = <int>[];
Expand All @@ -100,7 +101,7 @@ class BaseConversion extends InvertibleFunction<String, String> {
final (String r, int rLen) = changeBase(quotients);

return (r + _toAlphabet._characters[remainder], rLen + 1);
} else if (_intLengthFactor > 0) {
} /*else if (_intLengthFactor > 0) {
var (StringBuffer sb, int rLen) = (StringBuffer(), 0);
for (int i = 0; i < values.length; i++) {
final (String _r, int _rLen) = changeBase(values.sublist(i, i + 1));
Expand Down Expand Up @@ -139,7 +140,7 @@ class BaseConversion extends InvertibleFunction<String, String> {
}
return (sb.toString(), rLen);
}
}*/
}

final List<int> values = <int>[];
Expand Down

0 comments on commit 407f8e1

Please sign in to comment.