Skip to content
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

Fix: reduce the default reader and writer thread count #1076

Merged
merged 3 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ export default class Constants {
/**
* A reasonable max number of files to write at once.
*/
static readonly FILE_READER_DEFAULT_THREADS = 10;
static readonly FILE_READER_DEFAULT_THREADS = 8;

/**
* Max number of archive entries to process (possibly extract & MD5/SHA1/SHA256 checksum) at once.
*/
static readonly ARCHIVE_ENTRY_SCANNER_THREADS_PER_ARCHIVE = 5;
static readonly ARCHIVE_ENTRY_SCANNER_THREADS_PER_ARCHIVE = this.FILE_READER_DEFAULT_THREADS / 2;

/**
* A reasonable max number of ROM release candidates to write at once. This will be the limiting
* factor for consoles with many small ROMs.
*/
static readonly ROM_WRITER_DEFAULT_THREADS = 10;
static readonly ROM_WRITER_DEFAULT_THREADS = this.FILE_READER_DEFAULT_THREADS / 2;

/**
* Max number of files to recycle/delete at once.
Expand Down
8 changes: 4 additions & 4 deletions test/modules/argumentsParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ describe('options', () => {
expect(options.getPreferParent()).toEqual(false);

expect(options.getDatThreads()).toEqual(3);
expect(options.getReaderThreads()).toEqual(10);
expect(options.getWriterThreads()).toEqual(10);
expect(options.getReaderThreads()).toEqual(8);
expect(options.getWriterThreads()).toEqual(4);
expect(options.getDisableCache()).toEqual(false);
expect(options.getLogLevel()).toEqual(LogLevel.WARN);
expect(options.getHelp()).toEqual(false);
Expand Down Expand Up @@ -1137,15 +1137,15 @@ describe('options', () => {
});

it('should parse "reader-threads"', () => {
expect(argumentsParser.parse(dummyCommandAndRequiredArgs).getWriterThreads()).toEqual(10);
expect(argumentsParser.parse(dummyCommandAndRequiredArgs).getReaderThreads()).toEqual(8);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--reader-threads', '-1']).getReaderThreads()).toEqual(1);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--reader-threads', '0']).getReaderThreads()).toEqual(1);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--reader-threads', '1']).getReaderThreads()).toEqual(1);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--reader-threads', '2']).getReaderThreads()).toEqual(2);
});

it('should parse "writer-threads"', () => {
expect(argumentsParser.parse(dummyCommandAndRequiredArgs).getWriterThreads()).toEqual(10);
expect(argumentsParser.parse(dummyCommandAndRequiredArgs).getWriterThreads()).toEqual(4);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--writer-threads', '-1']).getWriterThreads()).toEqual(1);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--writer-threads', '0']).getWriterThreads()).toEqual(1);
expect(argumentsParser.parse([...dummyCommandAndRequiredArgs, '--writer-threads', '1']).getWriterThreads()).toEqual(1);
Expand Down
Loading