# What is the purpose to clone the Event's fields so many times in processing event

**URL:** <https://discuss.elastic.co/t/what-is-the-purpose-to-clone-the-events-fields-so-many-times-in-processing-event/346526>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 6, 2023, 1:28pm UTC](https://discuss.elastic.co/t/what-is-the-purpose-to-clone-the-events-fields-so-many-times-in-processing-event/346526 "2023-11-06T13:28:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![qshuai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/qshuai/32/127269_2.png) [@qshuai](https://discuss.elastic.co/u/qshuai)\
**Post date:** [November 6, 2023, 1:28pm UTC](https://discuss.elastic.co/t/what-is-the-purpose-to-clone-the-events-fields-so-many-times-in-processing-event/346526/1 "2023-11-06T13:28:03Z")

</div>

There are many times to Clone Event's fields in processing event. The method `Clone` is:

```auto
// Clone returns a copy of the MapStr. It recursively makes copies of inner
// maps.
func (m MapStr) Clone() MapStr {
	result := MapStr{}

	for k, v := range m {
		if innerMap, ok := tryToMapStr(v); ok {
			v = innerMap.Clone()
		}
		result[k] = v
	}

	return result
}

```

Calling `Clone` will cause GC busy and impact the performance heavily. I find there is not a lock operatoration so this is not a concurrency issue. So I am confused. I need your help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 4, 2023, 3:28pm UTC](https://discuss.elastic.co/t/what-is-the-purpose-to-clone-the-events-fields-so-many-times-in-processing-event/346526/2 "2023-12-04T15:28:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
