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

Performance regression with --gc:markandsweep #10271

Closed
rbehrends opened this Issue Jan 11, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@rbehrends
Copy link
Contributor

rbehrends commented Jan 11, 2019

As a result of this commit, the GC can be triggered for every allocation in a series of small allocations if compiled with --gc:markandsweep, leading to massive overhead.

Example

For example, on my machine the following code runs in 50ms with the default GC, but takes nearly 4 seconds with --gc:markandsweep.

const n = 1_000_000

type T =
  ref object
    val: int
    next: T

proc main =
  var t: T = nil
  for i in 1..n:
    t = T(val: i, next: t)

main()

@Araq Araq closed this in 451377f Jan 13, 2019

narimiran added a commit that referenced this issue Jan 14, 2019

fixes #10271 [backport]
(cherry picked from commit 451377f)
@timotheecour

This comment has been minimized.

Copy link
Collaborator

timotheecour commented Jan 14, 2019

maybe related to #10040

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