-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-factor how Metadata
class instances store its data internally
#11596
Conversation
- Remove the "capturing group" in the regular expression that removes leading "junk" from the raw metadata, since it's not necessary here (it's simply a case of too much copy-pasting in a prior patch). According to [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet#Groups_and_ranges) you want to, for performance reasons, avoid "capturing groups" unless actually needed. - Add inline comments to document a bunch of magic values in the code.
Please note that these changes do *not* affect the *public* interface of the `Metadata` class, but only touches internal structures.[1] These changes were prompted by looking at the `getAll` method, which simply returns the "private" metadata object to the consumer. This seems wrong conceptually, since it allows way too easy/accidental changes to the internal parsed metadata. As part of fixing this, the internal metadata was changed to use a `Map` rather than a plain Object. --- [1] Basically, we shouldn't need to worry about someone depending on internal implementation details.
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/984d657096ca9bd/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/655f95de6a11683/output.txt |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/655f95de6a11683/output.txt Total script time: 2.10 mins
Image differences available at: http://54.215.176.217:8877/655f95de6a11683/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/984d657096ca9bd/output.txt Total script time: 19.96 mins
Image differences available at: http://54.67.70.0:8877/984d657096ca9bd/reftest-analyzer.html#web=eq.log |
Nice improvements; thank you! |
Please note that these changes do not affect the public interface of the
Metadata
class, but only touches internal structures.[1]These changes were prompted by looking at the
getAll
method, which simply returns the "private" metadata object to the consumer. This seems wrong conceptually, since it allows way too easy/accidental changes to the internal parsed metadata.As part of fixing this, the internal metadata was changed to use a
Map
rather than a plain Object.[1] Basically, we shouldn't need to worry about someone depending on internal implementation details.