Eliminate array_merge() on insert call for performance

See #4553.