#2217 Optimize strcpy() into memcpy()

closed-rejected
None
other
5
2013-12-17
2013-09-12
No

When strcpy() is called with a string literal argument, we could use the cheaper memcpy() instead, since we know the string length at compile time.
String operations are common, so this matters to users. String operations are common in Dhrystone, so this matters to get good benchmark scores.

Philipp

Discussion

  • Hmm, memcpy() might not always be cheaper. Sure it will be cheaper on the z80-related ports, where we have ldir for memcpy(). But for the stm8, strcpy() actually seems to be cheaper, since sdcc can put all 5 bytes of variables into the 5 registers, while memcpy() results in a lot more and mroe expensive code due to spilt variables.

    Philipp

     
    • status: open --> closed-rejected
    • assigned_to: Philipp Klaus Krause
     
  • This is a feature request, not a bug report.

    Philipp