Skip to content

Add obj_need_obj_free_p - #99

Open
peterzhu2118 wants to merge 1 commit into
mainfrom
obj-free-candidate
Open

Add obj_need_obj_free_p#99
peterzhu2118 wants to merge 1 commit into
mainfrom
obj-free-candidate

Conversation

@peterzhu2118

Copy link
Copy Markdown
Member

We don't need to call obj_free on certain types of objects anymore including T_FLOAT, T_RATIONAL, T_COMPLEX, and T_OBJECT. It makes freeing those objects faster.

Benchmark:

i = 0
while i < 10_000_000
  Object.new
  i += 1
end

Before:

Time (mean ± σ):      1.435 s ±  0.013 s    [User: 1.706 s, System: 1.970 s]
Range (min … max):    1.418 s …  1.461 s    10 runs

After:

Time (mean ± σ):      1.230 s ±  0.027 s    [User: 1.335 s, System: 1.743 s]
Range (min … max):    1.206 s …  1.294 s    10 runs

We don't need to call obj_free on certain types of objects anymore including
T_FLOAT, T_RATIONAL, T_COMPLEX, and T_OBJECT. It makes freeing those objects
faster.

Benchmark:

    i = 0
    while i < 10_000_000
      Object.new
      i += 1
    end

Before:

    Time (mean ± σ):      1.435 s ±  0.013 s    [User: 1.706 s, System: 1.970 s]
    Range (min … max):    1.418 s …  1.461 s    10 runs

After:

    Time (mean ± σ):      1.230 s ±  0.027 s    [User: 1.335 s, System: 1.743 s]
    Range (min … max):    1.206 s …  1.294 s    10 runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant