Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

GC: optimize sweeping and allocation#2520

Closed
rainers wants to merge 6 commits intodlang:masterfrom
rainers:deferSweep2
Closed

GC: optimize sweeping and allocation#2520
rainers wants to merge 6 commits intodlang:masterfrom
rainers:deferSweep2

Conversation

@rainers
Copy link
Copy Markdown
Member

@rainers rainers commented Mar 24, 2019

The druntime-benchmarks mostly don't show a huge difference for these changes, but rand_small changes from

rand_small       3.637 s,    12 MB, 7642 GC 1262 ms, Pauses  444 ms <    0 ms

on win64 to

rand_small       3.260 s,    12 MB, 7642 GC 1080 ms, Pauses  439 ms <    0 ms

Results are more impressive for the extended vdparser test also shown here:

win32: 10.110 s, 1035 MB,   11 GC 1660 ms, Pauses 1361 ms <  562 ms
win64: 10.740 s, 1355 MB,   13 GC 1370 ms, Pauses 1030 ms <  385 ms

is changed to

win32: 7.600 s, 1035 MB,   11 GC 1594 ms, Pauses 1309 ms <  536 ms
win64: 7.570 s, 1419 MB,   13 GC 1410 ms, Pauses 1078 ms <  417 ms

@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request, @rainers!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + druntime#2520"

@rainers
Copy link
Copy Markdown
Member Author

rainers commented Mar 24, 2019

Ouch, sweep and recover cannot be combined if dtors of dead objeccts still access other dead objects. Closing for now...

@rainers rainers closed this Mar 24, 2019
@Geod24
Copy link
Copy Markdown
Member

Geod24 commented Mar 25, 2019

Ouch, sweep and recover cannot be combined if dtors of dead objeccts still access other dead objects. Closing for now...

The dtors are not supposed to access GC allocated objects though, as the order in which they run is not guaranteed. So isn't that exhibiting an issue in current current ?

@rainers
Copy link
Copy Markdown
Member Author

rainers commented Mar 25, 2019

The dtors are not supposed to access GC allocated objects though, as the order in which they run is not guaranteed. So isn't that exhibiting an issue in current current ?

It seems to happen in std.regex for reference counting. We could enforce it (by allowing crashes) but it also pretty much restricts even more what can sensibly be done in a dtor. Right now, other dead objects without a dtor are still in a valid state.

@rainers rainers reopened this Mar 25, 2019
@rainers rainers added the WIP Work In Progress - not ready for review or pulling label Mar 25, 2019
@rainers
Copy link
Copy Markdown
Member Author

rainers commented Mar 25, 2019

Added WIP: need to cleanup the history now that part of the changes have been reverted...

@Geod24
Copy link
Copy Markdown
Member

Geod24 commented Mar 25, 2019

It seems to happen in std.regex for reference counting.

Shouldn't that be done with malloc / free instead ?

@rainers
Copy link
Copy Markdown
Member Author

rainers commented Mar 25, 2019

Shouldn't that be done with malloc / free instead ?

Sorry, can't tell. The regex code is indistinguishable from magic. I just noted that a pointer in a dead object was modified by 1.

@Geod24
Copy link
Copy Markdown
Member

Geod24 commented Mar 26, 2019

Shall we summon our wizard in chief, @DmitryOlshansky ?

@rainers
Copy link
Copy Markdown
Member Author

rainers commented Mar 26, 2019

I'll split this into a couple of smaller PRs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

WIP Work In Progress - not ready for review or pulling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants