-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use numbers instead of strings for the DBActions and SyncEvents constants #6815
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
Use numbers instead of strings for the DBActions and SyncEvents constants #6815
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's easer to start other groups on 11
or even 101
so that if a few things are added to GENERAL
there is no need to reassign values for other groups
502968c
I've bumped the numbering for the other categories to start at 20, that gives us 14 more spots in the DBActions and 15 in the SyncEvents constants. Which leaves us a decent amount of flexibility without chosing numbers that are unnecessarily large. |
* development: (58 commits) Convert FtSubscribeButton and watch-video-info SCSS to CSS (FreeTubeApp#6814) Use numbers instead of strings for the DBActions and SyncEvents constants (FreeTubeApp#6815) Translated using Weblate (English (United Kingdom)) Fix: search history text overflows if search term is long (FreeTubeApp#6728) Check if a keyboard composition session is active when pressing 'Enter' on ft-input (FreeTubeApp#6799) use hq img (FreeTubeApp#6826) Move the choose default folder logic to the main process (FreeTubeApp#6811) Translated using Weblate (French) Translated using Weblate (Turkish) Set process.platform at build time (FreeTubeApp#6784) Use logical spec for float (FreeTubeApp#6783) Migrate DataSettings to the composition API (FreeTubeApp#6785) Local API: Improve audio quality by sorting streams, highest bitrate first (FreeTubeApp#6807) Bump sass from 1.84.0 to 1.85.0 (FreeTubeApp#6825) Bump webpack from 5.97.1 to 5.98.0 (FreeTubeApp#6820) Bump postcss from 8.5.1 to 8.5.2 in the stylelint group (FreeTubeApp#6819) Bump the babel group with 2 updates (FreeTubeApp#6817) Bump globals from 15.14.0 to 15.15.0 (FreeTubeApp#6823) Bump sass-loader from 16.0.4 to 16.0.5 (FreeTubeApp#6822) Bump eslint from 9.20.0 to 9.20.1 in the eslint group (FreeTubeApp#6818) ... # Conflicts: # src/renderer/components/watch-video-info/watch-video-info.scss # src/renderer/components/watch-video-info/watch-video-info.vue
…ants (FreeTubeApp#6815) * Use numbers instead of strings for the DBActions and SyncEvents constants * Fix duplicate number * Start offset numbers at 20
Use numbers instead of strings for the DBActions and SyncEvents constants
Pull Request Type
Description
Currently we use string values in our DBActions and SyncEvents constants. While there is nothing wrong with doing that, there are definitely a few advantages, such how long some of the strings have become e.g.
sync-subscriptions-update-shorts-with-channel-page-shorts-by-channel
.It is a well known fact that computers are great at crunching numbers, so switching to number values should not only be more performant but will also lower memory use and the bundle sizes (-1379 bytes from both the
main.js
andrenderer.js
files).From a development perspective this shouldn't have a big impact as we still have the human readable variable names and there is a code comment explaining that the numbers need to be unique/not overlap, so I don't think this will impact maintainance too much.
If you are wondering why I didn't do the same to the
IpcConstants
, it is because Electron requires string values for the IPC channel names.Testing
Desktop