Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] fiber: Drop redundant memset call
@ 2019-04-12  8:03 Cyrill Gorcunov
  2019-04-12 14:08 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2019-04-12  8:03 UTC (permalink / raw)
  To: tml; +Cc: Cyrill Gorcunov

When we allocate new fiber we are clearing the whole
structure right after, so no need to call memset again,
coro context is already full of zeros.

Note the coro context is close to 1K size and redundat
memset here is really a penalty.
---
 src/lib/core/fiber.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
index 38a3df511..283a53d58 100644
--- a/src/lib/core/fiber.c
+++ b/src/lib/core/fiber.c
@@ -959,7 +959,6 @@ fiber_new_ex(const char *name, const struct fiber_attr *fiber_attr,
 			mempool_free(&cord->fiber_mempool, fiber);
 			return NULL;
 		}
-		memset(&fiber->ctx, 0, sizeof(fiber->ctx));
 		coro_create(&fiber->ctx, fiber_loop, NULL,
 			    fiber->stack, fiber->stack_size);
 
-- 
2.20.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [tarantool-patches] [PATCH] fiber: Drop redundant memset call
  2019-04-12  8:03 [tarantool-patches] [PATCH] fiber: Drop redundant memset call Cyrill Gorcunov
@ 2019-04-12 14:08 ` Vladimir Davydov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2019-04-12 14:08 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml

On Fri, Apr 12, 2019 at 11:03:19AM +0300, Cyrill Gorcunov wrote:
> When we allocate new fiber we are clearing the whole
> structure right after, so no need to call memset again,
> coro context is already full of zeros.
> 
> Note the coro context is close to 1K size and redundat
> memset here is really a penalty.
> ---
>  src/lib/core/fiber.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
> index 38a3df511..283a53d58 100644
> --- a/src/lib/core/fiber.c
> +++ b/src/lib/core/fiber.c
> @@ -959,7 +959,6 @@ fiber_new_ex(const char *name, const struct fiber_attr *fiber_attr,
>  			mempool_free(&cord->fiber_mempool, fiber);
>  			return NULL;
>  		}
> -		memset(&fiber->ctx, 0, sizeof(fiber->ctx));
>  		coro_create(&fiber->ctx, fiber_loop, NULL,
>  			    fiber->stack, fiber->stack_size);
>  

Pushed to master.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-12 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12  8:03 [tarantool-patches] [PATCH] fiber: Drop redundant memset call Cyrill Gorcunov
2019-04-12 14:08 ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox