Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Calculate UniqueID via increment #163

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

RoadTrain
Copy link

@RoadTrain RoadTrain commented Apr 12, 2022

Instead of trying to find unique id randomly, which is costly, do it sequentially instead.
In this case, we have ~4 billion unique identifiers, and even if we exhaust them all, we will reset back to int.MinValue and start over.
It also helps getting rid of locking in the finalizer.

Fixes #162

Instead of trying to find unique id randomly, which is costly, do it sequentially instead.
In this case, we have ~4 billion unique identifiers, and even if we exhaust them all, we will reset back to int.MinValue and start over.
It also helps getting rid of locking in the finalizer.
@RoadTrain
Copy link
Author

RoadTrain commented Apr 12, 2022

I actually have no idea of the purpose of UniqueID other than instance comparison (why would anyone do that anyway?).
Neither could I find any usages of it by googling.

@RoadTrain
Copy link
Author

We're now testing this fix in our environment, will come back later with results.

@RoadTrain
Copy link
Author

RoadTrain commented Apr 18, 2022

So far so good. The performance issues went away with this fix.

@RoadTrain
Copy link
Author

@squid-box Hi! Could you take a look at this PR? We have been running this fix in our high-load environment for 7 months, so far no issues.

@squid-box
Copy link
Owner

@RoadTrain: Hi, sorry for being inactive for so long!

I'll admit I also don't really understand the usage of UniqueID, just another part of the mystery that is SevenZipSharp 🤷.
The changes look fine to me though, I'll merge it now - but have no real plan for when the next NuGet release will happen.

@squid-box squid-box merged commit 03a197c into squid-box:dev Mar 22, 2023
@RoadTrain RoadTrain deleted the uniqueid-performance branch March 27, 2023 01:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance issues when using many instances of SevenZipExtractor
2 participants