Why is add_arc so slow?

On my machine (Win10 i7-8750H 2.2GHz Nvidia GTX1060) and adding the 3000 arcs into a new group I am seeing consistently around 9.5 - 9.7 seconds.

What are the specs of the machine you are testing upon?

Adding to a new group means that the arcs will only need to be checked with their siblings for geometry merging, and not the rest of the model. The group can always be exploded at the end of the operation.

def go
  model = Sketchup.active_model
  entities = model.active_entities

  model.start_operation("Add arcs", true)
    t1 = Time.now
    grp = entities.add_group
    ents = grp.entities
    (1..3000).each { |x|
        Geom::Point3d.new(0, x*5, 0),
        X_AXIS, Z_AXIS, 10, 15.degrees, 135.degrees
    t2 = Time.now
  puts "time: #{t2.to_f-t1.to_f}\n"

Note in the above example, I’ve removed the assignments of the vectors and used the global constants X_AXIS and Z_AXIS. I also removed the unnecessary reference assignments from inside the each loop as these assignments are not really used later and they just eat time creating Ruby object references.

P.S. - In your post please fixed the code block. See: