Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Slow performance of spawning many Fibers #1478

Closed
tarcieri opened this Issue · 5 comments

4 participants

Tony Arcieri Charles Oliver Nutter Dirkjan Bussink Evan Phoenix
Tony Arcieri
Collaborator

Simple code example:

https://gist.github.com/1542400

This spawns 100,000 Fibers one-at-a-time, running each fiber to completion immediately after it's spawned. After a Fiber has been run to completion I would expect it no longer consumes system resources.

MRI plows through this example, consistently taking 5ms each time it spawns 1000 Fibers.

On rbx, the amount of time it takes to run the example increases with the number of Fibers spawned. At first it takes 12ms to spawn 1000 fibers, but this number quickly goes up. By the time it's spawned 100000 fibers it's taking nearly 1.5 seconds instead of 12ms.

Tony Arcieri
Collaborator

Some additional info:

I tried to trace this problem down with Instruments. I think it might be related to heap fragmentation, because according to instruments most of the time was spent in malloc. Here's a couple screenshots from the Instruments profiler:

http://minus.com/mCasnexwT#1
http://minus.com/mCasnexwT#2

Charles Oliver Nutter

It looks like a leak. On my system, memory grows without bounds. The lag is probably from growing heaps or increased GC times in the old generation.

Tony Arcieri
Collaborator

Confirmed. I changed the name of the ticket as such.

Evan Phoenix evanphx was assigned
Dirkjan Bussink
Owner

Is this still an issue with the new Fibers?

Tony Arcieri
Collaborator

Nope, new fibers look good!

Tony Arcieri tarcieri closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.