question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Improvement] String array function improvement

See original GitHub issue

Currently there is only one function, using which we get string from string array. With manged identifiers enabled it usually has name b. Here is the simplest example:

var a = [
    'log',
    'foo',
    'bar',
    'baz'
];
var b = function (c, d) {
    c = c - 0x0;
    var e = a[c];
    return e;
};
console[b('0x0')](b('0x1'), b('0x2'), b('0x3'));

I think it will be more interesting if you add more same functions and use random of them:

var a = [
    'log',
    'foo',
    'bar',
    'baz'
];
var b = function (c, d) {
    c = c - 0x0;
    var e = a[c];
    return e;
};
var c = function (c, d) { // Just define same function
    c = c - 0x0;
    var e = a[c];
    return e;
};
var d = b; // Make link to function
var e = function (c, d) { // Just define same function
    return b(c, d);
};
console[c('0x0')](b('0x1'), e('0x2'), d('0x3')); // And use random of them

Then you even can encode different strings with different algorithms - some of them just base64, some - rc4.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:69 (69 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Sep 11, 2020

The question is - should I enable stringArrayWrappersCount by default? Need to compare performance with/without this option. If the runtime performance is the same - maybe I’ll enable stringArrayWrappersCount by default with a value 1 or 2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code improvement, array of Strings - java - Stack Overflow
Can you give me some tips on how to improve my code? The problem was: Given an array of strings, return a new...
Read more >
10 Best Javascript Performance Tips For 2022 - Ksolves
In 2022, here are ten of the best tips for improving Javascript performance. Using String Replace Function. String.replace() is a built-in ...
Read more >
Understanding C++ String Array | DigitalOcean
The string keyword allocates memory to the elements of the array at dynamic or run-time accordingly. Thus it saves the headache of static...
Read more >
Improving Arrays in Hack - HHVM
When an array is passed to or returned from a function, the programmer has the guarantee that it will not be modified unless...
Read more >
`array` type improvements · Issue #9122 · php/php-src - GitHub
Here I suggest five features which can greatly improve typing array s and throw away the need of most related docblocks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found