Skip to content

Runtime performance degradation for highly nested depending csharp files #24330

@fgarciacorona

Description

@fgarciacorona

What version of protobuf and what language are you using?
Version: 3.33.0
Language: C#

What operating system (Linux, Windows, ...) and version?
Windows 11

What runtime / compiler are you using (e.g., python version or gcc version)
.Net 8

What did you do?
Open the attached sample project.
test-performance-protos.zip

dotnet restore
dotnet build
dotnet test

What did you expect to see
The first loading of the Example message should happen quickly. This happened before in v3.5.1 before extensions were added.

What did you see instead?
The only unit test that is there will test whether the loading of the FileDescriptor of the Example message takes less than 500ms. The testcase will fail because it takes more than 1 minute.

Anything else we should know about your project / environment
I have created PR #20392 where the error is reproduced in a small fashion (not big time impact for testing) and the fix is evaluated before and after using a cache mechanism. The reduction on the number of queries when depending on the same proto files is > 1000 times. Time is reduced as well, but not very significant because the created sample is not very highly nested.

When I test this with the changes from the PR #20392 it takes 52ms for the test to run instead of ~69000ms.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions