Skip to content

Commit

Permalink
Merge pull request #178 from marcwrobel/172-get-rid-of-regexes-in-cre…
Browse files Browse the repository at this point in the history
…ditoridentifier

Get rid of regexes in `CreditorIdentifier`
  • Loading branch information
marcwrobel authored Jul 26, 2022
2 parents 9c96481 + 810e2de commit c6dd0ed
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 152 deletions.
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Added

- Document alternatives to jbanking (#164).
- Make `CreditorIdentifier#REGEX` public (as part of #172).

### Changed

- (**breaking change**) Make `CreditorIdentifier` final (#116).
- (**breaking change**) Rename `Bic#BIC_REGEX` to `Bic#REGEX` (as part of #170).
- Get rid of regexes to validate BICs (#170). This significantly increased the performances of BIC validation (x3) and
creation (x4).
- (**breaking change**) Rename `Bic#BIC_REGEX` to `Bic#REGEX` and change it to not accept lower-case characters anymore
(as part of #170).
- Get rid of regexes to validate BICs (#170). This significantly increased the performances of BIC validation (+200%)
and creation (+300%).
- Get rid of regexes to validate Creditor Identifiers (#172). This significantly increased the performances of
Creditor Identifiers validation (+30-40%) and creation (+30-50%).
- Improve javadoc (as part of #170 and #172).

### Fixed

Expand All @@ -27,6 +32,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Alphabetically sort `IsoCurrency`, `Holidays` and `BbanStructure` enums entries (#161).
- Bump strata-basics from 2.12.5 to 2.12.6 (#165).
- Add benchmarks that track the evolution of jbanking performances from version to version (#166).
- Add benchmarks that track the evolution of jbanking performances from version to version (#166). Some numbers can be
seen [here](benchmarks/README.md).

### Thanks
132 changes: 66 additions & 66 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,69 +37,69 @@ All test were run with in the following conditions :
- 1 thread,
- blackhole mode: full + dont-inline hint.

| Name | Parameter | Version | Ops/s | Increase |
|------------------------------------------|---------------------------------|----------------|-----------:|---------:|
| b.BicBenchmark.creation | AECFFR21 | 1.0 | 2,444,715 | N/A |
| b.BicBenchmark.creation | AECFFR21 | 2.1.0 | 2,481,546 | +1.48% |
| b.BicBenchmark.creation | AECFFR21 | 3.4.0 | 6,649,405 | +62.68% |
| b.BicBenchmark.creation | AECFFR21 | 4.0.0-SNAPSHOT | 19,604,576 | +194.83% |
| b.BicBenchmark.creation | AECFFR21XXX | 1.0 | 2,512,454 | N/A |
| b.BicBenchmark.creation | AECFFR21XXX | 2.1.0 | 2,550,922 | +1.51% |
| b.BicBenchmark.creation | AECFFR21XXX | 3.4.0 | 8,066,353 | +216.21 |
| b.BicBenchmark.creation | AECFFR21XXX | 4.0.0-SNAPSHOT | 23,230,205 | +187.98 |
| b.BicBenchmark.validation | AECFFR21 | 1.0 | 2,701,550 | N/A |
| b.BicBenchmark.validation | AECFFR21 | 2.1.0 | 2,831,007 | +4.57% |
| b.BicBenchmark.validation | AECFFR21 | 3.4.0 | 8,874,888 | +302.85% |
| b.BicBenchmark.validation | AECFFR21 | 4.0.0-SNAPSHOT | 35,753,064 | 309.83% |
| b.BicBenchmark.validation | AECFFR21XXX | 2.1.0 | 2,527,600 | N/A |
| b.BicBenchmark.validation | AECFFR21XXX | 1.0 | 2,676,293 | +5.56% |
| b.BicBenchmark.validation | AECFFR21XXX | 3.4.0 | 7,797,982 | +191.37% |
| b.BicBenchmark.validation | AECFFR21XXX | 4.0.0-SNAPSHOT | 32,069,027 | +311.24% |
| b.CalendarBenchmark.validation | NEW_YORK_FED | 4.0.0-SNAPSHOT | 1,464,062 | N/A |
| b.CalendarBenchmark.validation | NEW_YORK_FED | 3.4.0 | 1,508,236 | +2.93% |
| b.CalendarBenchmark.validation | PARIS | 3.4.0 | 2,703,850 | N/A |
| b.CalendarBenchmark.validation | PARIS | 4.0.0-SNAPSHOT | 2,710,297 | +0.24% |
| b.CalendarBenchmark.validation | SATURDAY_SUNDAY | 3.4.0 | 20,365,368 | N/A |
| b.CalendarBenchmark.validation | SATURDAY_SUNDAY | 4.0.0-SNAPSHOT | 21,186,208 | +3.87% |
| b.CreditorIdentifierBenchmark.creation | BE69ZZZ050D000000008 | 2.1.0 | 1,179,963 | N/A |
| b.CreditorIdentifierBenchmark.creation | BE69ZZZ050D000000008 | 4.0.0-SNAPSHOT | 1,339,117 | +11.89% |
| b.CreditorIdentifierBenchmark.creation | BE69ZZZ050D000000008 | 3.4.0 | 1,473,817 | +9.14% |
| b.CreditorIdentifierBenchmark.creation | CY54ZZZ003A | 2.1.0 | 1,353,862 | N/A |
| b.CreditorIdentifierBenchmark.creation | CY54ZZZ003A | 4.0.0-SNAPSHOT | 1,982,338 | +31.70% |
| b.CreditorIdentifierBenchmark.creation | CY54ZZZ003A | 3.4.0 | 2,006,483 | +1.20% |
| b.CreditorIdentifierBenchmark.creation | GB23ZZZSDDBARC000000ABCD1234 | 2.1.0 | 650,804 | N/A |
| b.CreditorIdentifierBenchmark.creation | GB23ZZZSDDBARC000000ABCD1234 | 4.0.0-SNAPSHOT | 1,269,066 | +48.72% |
| b.CreditorIdentifierBenchmark.creation | GB23ZZZSDDBARC000000ABCD1234 | 3.4.0 | 1,293,270 | +1.87% |
| b.CreditorIdentifierBenchmark.validation | BE69ZZZ050D000000008 | 2.1.0 | 1,171,900 | N/A |
| b.CreditorIdentifierBenchmark.validation | BE69ZZZ050D000000008 | 3.4.0 | 1,485,479 | +21.11% |
| b.CreditorIdentifierBenchmark.validation | BE69ZZZ050D000000008 | 4.0.0-SNAPSHOT | 1,525,590 | +2.63% |
| b.CreditorIdentifierBenchmark.validation | CY54ZZZ003A | 2.1.0 | 1359341 | N/A |
| b.CreditorIdentifierBenchmark.validation | CY54ZZZ003A | 4.0.0-SNAPSHOT | 2,022,577 | +32.79% |
| b.CreditorIdentifierBenchmark.validation | CY54ZZZ003A | 3.4.0 | 2,044,620 | +1.08% |
| b.CreditorIdentifierBenchmark.validation | GB23ZZZSDDBARC000000ABCD1234 | 2.1.0 | 647,807 | N/A |
| b.CreditorIdentifierBenchmark.validation | GB23ZZZSDDBARC000000ABCD1234 | 4.0.0-SNAPSHOT | 1,242,825 | +47.88% |
| b.CreditorIdentifierBenchmark.validation | GB23ZZZSDDBARC000000ABCD1234 | 3.4.0 | 1,283,238 | +3.15% |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 2.1.0 | 503,185 | N/A |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 1.0 | 537,262 | +6.34% |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 4.0.0-SNAPSHOT | 1,106,781 | +51.46% |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 3.4.0 | 1,130,385 | +2.09% |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 2.1.0 | 515,480 | N/A |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 1.0 | 533,216 | +3.33% |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 3.4.0 | 897,188 | +40.57% |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 4.0.0-SNAPSHOT | 956,700 | +6.22% |
| b.IbanBenchmark.creation | NO2451742753161 | 2.1.0 | 628,450 | N/A |
| b.IbanBenchmark.creation | NO2451742753161 | 1.0 | 655,568 | +4.14% |
| b.IbanBenchmark.creation | NO2451742753161 | 3.4.0 | 1,388,082 | +52.77% |
| b.IbanBenchmark.creation | NO2451742753161 | 4.0.0-SNAPSHOT | 1,468,227 | +5.46% |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 2.1.0 | 502,608 | N/A |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 1.0 | 511,613 | +1.76% |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 3.4.0 | 1,064,568 | +51.94% |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 4.0.0-SNAPSHOT | 1,108,403 | +3.95% |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 2.1.0 | 523,769 | N/A |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 1.0 | 532,346 | +1.61% |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 4.0.0-SNAPSHOT | 879,841 | +39.50% |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 3.4.0 | 902,781 | +2.54% |
| b.IbanBenchmark.validation | NO2451742753161 | 2.1.0 | 622,808 | N/A |
| b.IbanBenchmark.validation | NO2451742753161 | 1.0 | 670,624 | +7.13% |
| b.IbanBenchmark.validation | NO2451742753161 | 3.4.0 | 1,448,533 | +53.70% |
| b.IbanBenchmark.validation | NO2451742753161 | 4.0.0-SNAPSHOT | 1,484,615 | +2.43% |
| Name | Parameter | Version | Ops/s | Increase |
|------------------------------------------|---------------------------------|----------------|------------|----------|
| b.BicBenchmark.creation | AECFFR21 | 1.0 | 2,460,731 | N/A |
| b.BicBenchmark.creation | AECFFR21 | 2.1.0 | 2,591,447 | 5.31% |
| b.BicBenchmark.creation | AECFFR21 | 3.4.0 | 6,861,639 | 164.78% |
| b.BicBenchmark.creation | AECFFR21 | 4.0.0-SNAPSHOT | 21,039,659 | 206.63% |
| b.BicBenchmark.creation | AECFFR21XXX | 1.0 | 2,450,359 | N/A |
| b.BicBenchmark.creation | AECFFR21XXX | 2.1.0 | 2,487,616 | 1.52% |
| b.BicBenchmark.creation | AECFFR21XXX | 3.4.0 | 6,852,577 | 175.47% |
| b.BicBenchmark.creation | AECFFR21XXX | 4.0.0-SNAPSHOT | 25,302,021 | 269.23% |
| b.BicBenchmark.validation | AECFFR21 | 1.0 | 2,659,735 | N/A |
| b.BicBenchmark.validation | AECFFR21 | 2.1.0 | 2,819,303 | 6.00% |
| b.BicBenchmark.validation | AECFFR21 | 3.4.0 | 9,241,672 | 227.80% |
| b.BicBenchmark.validation | AECFFR21 | 4.0.0-SNAPSHOT | 39,789,078 | 330.54% |
| b.BicBenchmark.validation | AECFFR21XXX | 1.0 | 2,644,390 | N/A |
| b.BicBenchmark.validation | AECFFR21XXX | 2.1.0 | 2,670,018 | 0.97% |
| b.BicBenchmark.validation | AECFFR21XXX | 3.4.0 | 7,978,573 | 198.82% |
| b.BicBenchmark.validation | AECFFR21XXX | 4.0.0-SNAPSHOT | 37,336,445 | 367.96% |
| b.CalendarBenchmark.validation | NEW_YORK_FED | 3.4.0 | 1,436,109 | N/A |
| b.CalendarBenchmark.validation | NEW_YORK_FED | 4.0.0-SNAPSHOT | 1,497,954 | 4.31% |
| b.CalendarBenchmark.validation | PARIS | 4.0.0-SNAPSHOT | 2,665,496 | N/A |
| b.CalendarBenchmark.validation | PARIS | 3.4.0 | 2,689,448 | 0.90% |
| b.CalendarBenchmark.validation | SATURDAY_SUNDAY | 3.4.0 | 20,483,692 | N/A |
| b.CalendarBenchmark.validation | SATURDAY_SUNDAY | 4.0.0-SNAPSHOT | 20,883,830 | 1.95% |
| b.CreditorIdentifierBenchmark.creation | BE69ZZZ050D000000008 | 2.1.0 | 1,155,706 | N/A |
| b.CreditorIdentifierBenchmark.creation | BE69ZZZ050D000000008 | 3.4.0 | 1,442,163 | 24.79% |
| b.CreditorIdentifierBenchmark.creation | BE69ZZZ050D000000008 | 4.0.0-SNAPSHOT | 2,002,731 | 38.87% |
| b.CreditorIdentifierBenchmark.creation | CY54ZZZ003A | 2.1.0 | 1,328,852 | N/A |
| b.CreditorIdentifierBenchmark.creation | CY54ZZZ003A | 3.4.0 | 1,973,522 | 48.51% |
| b.CreditorIdentifierBenchmark.creation | CY54ZZZ003A | 4.0.0-SNAPSHOT | 2,725,699 | 38.11% |
| b.CreditorIdentifierBenchmark.creation | GB23ZZZSDDBARC000000ABCD1234 | 2.1.0 | 618,766 | N/A |
| b.CreditorIdentifierBenchmark.creation | GB23ZZZSDDBARC000000ABCD1234 | 3.4.0 | 1,236,274 | 99.80% |
| b.CreditorIdentifierBenchmark.creation | GB23ZZZSDDBARC000000ABCD1234 | 4.0.0-SNAPSHOT | 1,634,802 | 32.24% |
| b.CreditorIdentifierBenchmark.validation | BE69ZZZ050D000000008 | 2.1.0 | 1,134,536 | N/A |
| b.CreditorIdentifierBenchmark.validation | BE69ZZZ050D000000008 | 3.4.0 | 1,487,712 | 31.13% |
| b.CreditorIdentifierBenchmark.validation | BE69ZZZ050D000000008 | 4.0.0-SNAPSHOT | 2,049,455 | 37.76% |
| b.CreditorIdentifierBenchmark.validation | CY54ZZZ003A | 2.1.0 | 1,369,866 | N/A |
| b.CreditorIdentifierBenchmark.validation | CY54ZZZ003A | 3.4.0 | 2,023,290 | 47.70% |
| b.CreditorIdentifierBenchmark.validation | CY54ZZZ003A | 4.0.0-SNAPSHOT | 2,743,085 | 35.58% |
| b.CreditorIdentifierBenchmark.validation | GB23ZZZSDDBARC000000ABCD1234 | 2.1.0 | 634,193 | N/A |
| b.CreditorIdentifierBenchmark.validation | GB23ZZZSDDBARC000000ABCD1234 | 3.4.0 | 1,223,625 | 92.94% |
| b.CreditorIdentifierBenchmark.validation | GB23ZZZSDDBARC000000ABCD1234 | 4.0.0-SNAPSHOT | 1,869,288 | 52.77% |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 2.1.0 | 489,264 | N/A |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 1.0 | 546,745 | 11.75% |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 4.0.0-SNAPSHOT | 1,088,098 | 99.01% |
| b.IbanBenchmark.creation | ES2837832292261368335005 | 3.4.0 | 1,159,728 | 6.58% |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 2.1.0 | 508,675 | N/A |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 1.0 | 559,173 | 9.93% |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 3.4.0 | 841,874 | 50.56% |
| b.IbanBenchmark.creation | MT84AIWA00813109843252965695890 | 4.0.0-SNAPSHOT | 856,814 | 1.77% |
| b.IbanBenchmark.creation | NO2451742753161 | 2.1.0 | 632,637 | N/A |
| b.IbanBenchmark.creation | NO2451742753161 | 1.0 | 657,696 | 3.96% |
| b.IbanBenchmark.creation | NO2451742753161 | 4.0.0-SNAPSHOT | 1,388,058 | 111.05% |
| b.IbanBenchmark.creation | NO2451742753161 | 3.4.0 | 1,424,889 | 2.65% |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 2.1.0 | 501,785 | N/A |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 1.0 | 508,206 | 1.28% |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 3.4.0 | 1,054,861 | 107.57% |
| b.IbanBenchmark.validation | ES2837832292261368335005 | 4.0.0-SNAPSHOT | 1,154,262 | 9.42% |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 2.1.0 | 515,006 | N/A |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 1.0 | 530,957 | 3.10% |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 3.4.0 | 871,960 | 64.22% |
| b.IbanBenchmark.validation | MT84AIWA00813109843252965695890 | 4.0.0-SNAPSHOT | 928,907 | 6.53% |
| b.IbanBenchmark.validation | NO2451742753161 | 2.1.0 | 625,019 | N/A |
| b.IbanBenchmark.validation | NO2451742753161 | 1.0 | 650,438 | 4.07% |
| b.IbanBenchmark.validation | NO2451742753161 | 3.4.0 | 1,409,987 | 116.78% |
| b.IbanBenchmark.validation | NO2451742753161 | 4.0.0-SNAPSHOT | 1,419,185 | 0.65% |
8 changes: 4 additions & 4 deletions src/main/java/fr/marcwrobel/jbanking/bic/Bic.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public final class Bic implements Serializable {
private static final long serialVersionUID = 0;

/**
* A simple regex that validate well-formed BIC.
* A simple regex that validate well-formed BICs.
*/
@SuppressWarnings("unused") // kept for compatibility and documentation purposes
public static final String REGEX = "[A-Za-z]{4}[A-Za-z]{2}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?";
public static final String REGEX = "[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?";

/**
* The branch code for primary offices.
Expand Down Expand Up @@ -93,8 +93,8 @@ public final class Bic implements Serializable {
*
* @param bic8Or11 A non-null String.
* @throws IllegalArgumentException if the given string is {@code null}
* @throws BicFormatException if the given BIC8 or BIC11 string does not match {@value #REGEX} or if the given BIC8 or
* BIC11 country code is not known in {@link fr.marcwrobel.jbanking.IsoCountry}.
* @throws BicFormatException if the given string does not match {@value #REGEX} or if its country code is not known in
* {@link fr.marcwrobel.jbanking.IsoCountry}
*/
public Bic(final String bic8Or11) {
if (bic8Or11 == null) {
Expand Down
Loading

0 comments on commit c6dd0ed

Please sign in to comment.