]> git.wincent.com - wikitext.git/commit
Add ary_includes2, ary_includes3 functions
authorWincent Colaiuta <win@wincent.com>
Wed, 13 May 2009 09:04:16 +0000 (11:04 +0200)
committerWincent Colaiuta <win@wincent.com>
Wed, 13 May 2009 09:04:16 +0000 (11:04 +0200)
commit162be7200332b8e46f1fe611924cdccf3a54f0ba
treea20b6f7499feb466ecea7b6d17b818e0d4240247
parentc9e0c3e6ec79bf2d5c08389819328cadd0320ab4
Add ary_includes2, ary_includes3 functions

A fairly common pattern in the codebase is successively calling
the ary_includes function 1, 2 or 3 times. In the worst case
scenario this incurs 3 function calls and three array traversals
via a for-loop in the function.

Add 2 and 3-argument variants of the function so that we can
replace these instances with a single function call and a single
array traversal.

As shown in the benchmarking notes, this bumps the ary_includes
function from 4th place in the profile (where it was the "low-hanging
fruit") and right off the list.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
benchmarks/NOTES.txt
ext/ary.c
ext/ary.h
ext/parser.c