Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Slow performance of spawning many Fibers #1478

tarcieri opened this Issue · 5 comments

4 participants


Simple code example:

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.


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:


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.


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

@evanphx evanphx was assigned

Is this still an issue with the new Fibers?


Nope, new fibers look good!

@tarcieri 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.