Skip to content

Commit

Permalink
Fix: reduce the default reader and writer thread count (#1076)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm committed Apr 7, 2024
1 parent 45596f8 commit e3d0d2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit e3d0d2e

Please sign in to comment.