mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Bombe: Firefox optimisation
Switch a couple of for of loops in the critical path for classic fors. This loses about 10% performance in Chrome, but it brings Firefox performance in line with Chrome's, rather than 2.5 times slower.
This commit is contained in:
parent
3eb44708e5
commit
78768e00d4
1 changed files with 4 additions and 2 deletions
|
@ -514,7 +514,8 @@ export class BombeMachine {
|
||||||
const idxPair = 26*j + i;
|
const idxPair = 26*j + i;
|
||||||
this.wires[idxPair] = true;
|
this.wires[idxPair] = true;
|
||||||
|
|
||||||
for (const scrambler of this.scramblers[i]) {
|
for (let k=0; k<this.scramblers[i].length; k++) {
|
||||||
|
const scrambler = this.scramblers[i][k];
|
||||||
const out = scrambler.transform(j);
|
const out = scrambler.transform(j);
|
||||||
const other = scrambler.getOtherEnd(i);
|
const other = scrambler.getOtherEnd(i);
|
||||||
this.energise(other, out);
|
this.energise(other, out);
|
||||||
|
@ -522,7 +523,8 @@ export class BombeMachine {
|
||||||
if (i === j) {
|
if (i === j) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const scrambler of this.scramblers[j]) {
|
for (let k=0; k<this.scramblers[j].length; k++) {
|
||||||
|
const scrambler = this.scramblers[j][k];
|
||||||
const out = scrambler.transform(i);
|
const out = scrambler.transform(i);
|
||||||
const other = scrambler.getOtherEnd(j);
|
const other = scrambler.getOtherEnd(j);
|
||||||
this.energise(other, out);
|
this.energise(other, out);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue