summaryrefslogtreecommitdiff
path: root/strings/apr_cstr.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing whitespaces in *.c.ivan2022-11-201-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* apr_cstr: Follow up to r1897102: Yet better apr_cstr_casecmp[n]().ylavic2022-01-161-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | This ones have a shorter prologue and epilogue (-O2 still). Dump of assembler code for function apr_cstr_casecmp: 0x0000000000049fd0 <+0>: xor %edx,%edx 0x0000000000049fd2 <+2>: lea 0x3d567(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fd9 <+9>: nopl 0x0(%rax) 0x0000000000049fe0 <+16>: movzbl (%rsi,%rdx,1),%eax 0x0000000000049fe4 <+20>: movzbl (%r8,%rax,1),%ecx 0x0000000000049fe9 <+25>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fed <+29>: add $0x1,%rdx 0x0000000000049ff1 <+33>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff6 <+38>: sub %ecx,%eax 0x0000000000049ff8 <+40>: jne 0x49ffe <apr_cstr_casecmp+46> 0x0000000000049ffa <+42>: test %ecx,%ecx 0x0000000000049ffc <+44>: jne 0x49fe0 <apr_cstr_casecmp+16> 0x0000000000049ffe <+46>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897121 13f79535-47bb-0310-9956-ffa450edef68
* apr_cstr: Improve apr_cstr_casecmp() and apr_cstr_casecmpn() performances.ylavic2022-01-151-26/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new versions [1] compile to a shorter/faster assembly than the previous ones [2], no functionnal change. [1] apr_cstr_casecmp() after this commit: Dump of assembler code for function apr_cstr_casecmp: 0x0000000000049fc0 <+0>: movzbl (%rdi),%eax 0x0000000000049fc3 <+3>: movzbl (%rsi),%edx 0x0000000000049fc6 <+6>: lea 0x3d573(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fcd <+13>: movzbl (%r8,%rax,1),%eax 0x0000000000049fd2 <+18>: movzbl (%r8,%rdx,1),%ecx 0x0000000000049fd7 <+23>: cmp %ecx,%eax 0x0000000000049fd9 <+25>: jne 0x49ffe <apr_cstr_casecmp+62> 0x0000000000049fdb <+27>: xor %edx,%edx 0x0000000000049fdd <+29>: jmp 0x49ffa <apr_cstr_casecmp+58> 0x0000000000049fdf <+31>: nop 0x0000000000049fe0 <+32>: add $0x1,%rdx 0x0000000000049fe4 <+36>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fe8 <+40>: movzbl (%rsi,%rdx,1),%ecx 0x0000000000049fec <+44>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff1 <+49>: movzbl (%r8,%rcx,1),%ecx 0x0000000000049ff6 <+54>: cmp %ecx,%eax 0x0000000000049ff8 <+56>: jne 0x49ffe <apr_cstr_casecmp+62> 0x0000000000049ffa <+58>: test %eax,%eax 0x0000000000049ffc <+60>: jne 0x49fe0 <apr_cstr_casecmp+32> 0x0000000000049ffe <+62>: sub %ecx,%eax 0x000000000004a000 <+64>: ret End of assembler dump. [2] apr_cstr_casecmp() before this commit: Dump of assembler code for function apr_cstr_casecmp: 0x000000000004a000 <+0>: movzbl (%rdi),%eax 0x000000000004a003 <+3>: movzbl (%rsi),%edx 0x000000000004a006 <+6>: lea 0x3d533(%rip),%r8 # 0x87540 <ucharmap> 0x000000000004a00d <+13>: mov %rdi,%r9 0x000000000004a010 <+16>: mov %rax,%rcx 0x000000000004a013 <+19>: movswl (%r8,%rdx,2),%edx 0x000000000004a018 <+24>: movswl (%r8,%rax,2),%eax 0x000000000004a01d <+29>: sub %edx,%eax 0x000000000004a01f <+31>: jne 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a021 <+33>: mov $0x1,%edx 0x000000000004a026 <+38>: test %ecx,%ecx 0x000000000004a028 <+40>: je 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a02a <+42>: nopw 0x0(%rax,%rax,1) 0x000000000004a030 <+48>: movzbl (%r9,%rdx,1),%eax 0x000000000004a035 <+53>: movzbl (%rsi,%rdx,1),%ecx 0x000000000004a039 <+57>: add $0x1,%rdx 0x000000000004a03d <+61>: mov %rax,%rdi 0x000000000004a040 <+64>: movswl (%r8,%rcx,2),%ecx 0x000000000004a045 <+69>: movswl (%r8,%rax,2),%eax 0x000000000004a04a <+74>: sub %ecx,%eax 0x000000000004a04c <+76>: jne 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a04e <+78>: test %edi,%edi 0x000000000004a050 <+80>: jne 0x4a030 <apr_cstr_casecmp+48> 0x000000000004a052 <+82>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897102 13f79535-47bb-0310-9956-ffa450edef68
* More revert of r1887500.ylavic2021-03-111-15/+26
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887505 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887060: fix compilation on BEOS.ylavic2021-03-111-26/+15
| | | | | | | | | | poffset is undefined there, by inspection (no BEOS at hand..). [Reverted by r1887502 and r1887505] git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887500 13f79535-47bb-0310-9956-ffa450edef68
* Follow-up to r1726928: Add APR_DECLARE() to apr_cstr_*() functionsivan2016-10-281-30/+36
| | | | | | | declaration to fix Windows build. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1767019 13f79535-47bb-0310-9956-ffa450edef68
* Upon closer scrutiny, the optimization of using short variableswrowe2016-06-081-8/+12
| | | | | | | | | | | | | (as opposed to the array of shorts) really didn't hold up. Revert back to processing in 'int' amounts, persist in using short values in the character case folding table, which are more easily retrieved based on word alignment. Aligning and representing the table values as 'int' doesn't exhibit any additional benefit and wastes some DATA page space. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1747461 13f79535-47bb-0310-9956-ffa450edef68
* Third optimization, use short type, which is the smallestwrowe2016-06-081-8/+8
| | | | | | | | | | | | functional int which requires 1. no unsigned -> signed promotion, 2. fetches from a word aligned offset from the lookup table, 3. is easily promoted to int upon the function's return. This introduces a very small 2% speed improvement in several cases. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1747460 13f79535-47bb-0310-9956-ffa450edef68
* Additional 17% speedup by deferring unused pointer incrementswrowe2016-06-081-4/+8
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1747425 13f79535-47bb-0310-9956-ffa450edef68
* 17% speedup by eliminating redundant eos testwrowe2016-06-081-2/+4
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1747424 13f79535-47bb-0310-9956-ffa450edef68
* Introduce the subset of svn_cstring_ functions into APR as the apr_cstr_wrowe2016-01-271-0/+392
family of functions. Requires the introduction of APR_ERANGE. Solves apr_cstr_casecmp[n] for ASCII and EBCDIC and borrows from the work of jim, ylavic and wrowe, see r1715401 forwards in; http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?view=log&pathrev=1722194 More performance review is needed against different compilers, so went ahead and borrowed original svn implementation as a basis, and we can port whichever performance enhancements test out more efficiently. Proposing for APR 1.6.0 which is the thought behind the initial @since tags. These must be changed if not accepted for backport. Note that the svn_cstring_join function could not be implemented as-is due to the absence of svn's counted string functionality. It deserves an implementation if not already present, or should be removed before tagging or backporting. No whitespace/formatting cleanup on this pass in order to preserve as much of the svn attributions as possible. This can happen in a later pass to conform to APR's style conventions. While renaming the functions, declarations themsel git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1726928 13f79535-47bb-0310-9956-ffa450edef68