New submission from fj92f3jj923f923 <watashiwa...@gmail.com>:

Hi, all!

strdup implementation inside cpython/Python/strdup.c is not the best one.
It calls strlen + strcpy, which is the same as calling strlen twice + memcpy.
So I replaced it by the call of strlen + memcpy.

It is easy to look any implementation in any library.
Here for example:
https://code.woboq.org/userspace/glibc/string/strdup.c.html

So I fixed it here:
https://github.com/python/cpython/pull/21544

----------
components: C API
messages: 373955
nosy: fj92f3jj923f923
priority: normal
severity: normal
status: open
title: Not very good strcpy implementation in cpython/Python/strdup.c
type: performance
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41340>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to