7. Practical considerations

7.1. Performance

ɸ STL δؿ֥ȤХΥСإåɤƱͤ Ūˤ STL 르ꥺ ˥ե󥯥λѤˤ Υ롼פӤƤΥСإåɤ Ŭˤä롣 ѥ˰¸ƤΤΡϼºݤ GCC 3.0.4 ѤơIntel Pentium 4 1.5 GHz Υޥ ĤΥƥȤԤʤäŬե饰 -O3 Ȥ

ǽΥƥȤǤϡ˥ե󥯥Ū˽񤤤ؿ֥ȤӤ ˷֤ʬȤͤ򤫤ñؿξη ؿϤơx5 ޤǼ¸Ԥä μ std::transform Υ롼פǸƽФ졢 std::vector<int> ɤ߽Ф ̤̤ std::vector<int> ˳Ǽ vector ǿ 100 Ȥ ¹Ի֤ϡ Table 3 ˼Ƥ롣 Ĥˡ礭ʺϤʤȤʬ롣

ܤΥƥȤǤϡ100ĤǤ vector γǤФԤᡢ Ƥ std::transform Ѥ ϡvector Ǥη double Ǥꡢ ˴ñʻѼϤơʣʤΤؤȤƤä ¹Ի֤ Table 4 ˼ Ǥϡ STL ̵̾ؿƥȤ˲äƤ롣 μϤʣˤʤ뤿󼨤ʤ 㤨С Table 4 κǸμϡ STL ˡǵҤȡ compose2 θƽФȡȬ bind1st θƽФ multipliesminusplus Υ֥Ȥιۤ ׽ͲΥ󥹥ȥ饯θƽФޤळȤˤʤ롣 ΥƥȤˤƤϡб񤭤δؿ֥ȤӤơ BLL μϾ٤(ޤ˸äʿѤ 10% 14% ۤ) STL μǤϥѥեޥ󥹤㲼Ϥ⤦礭 ñʼǤ 27% ۤɤˤʤäƤ롣

ΥƥȤ顢BLL STL δؿ֥ȤӤ ѥեޥ󥹤㲼򾷤ƤϤʤ ŬʺŬѥѤСѥեޥ󥹤ϡ STL ȤäΤɤŨȻפ롣 ˡñʼǤСŪ˵Ҥؿ֥Ȥξ ѥեޥ󥹤˶ᤤȹͤ롣 ˥ե󥯥ɾϡ饤줿ʴؿθƽФ Ϣ³Ǥ뤿ᡢѥ餬Υ饤Ÿ˼Ԥȡ ѥեޥ󥹤㲼 ʤä硢¹Ի֤ܰʾˤʤ뤫⤷ʤ 嵭ΥƥȤϤΤ褦ʤȤȯ뼰ޤǤʤ 츫ñʼǡΤ褦ˤʤäȤ⤢롣

Table 3. Test 1. ˼ǵҤξ軻 μ񤭤δؿ֥ȥ饹ǵҤξ軻 CPU ֤ӡ ¹Ի֤ñ̤ŪǤ롣

expressionlambda expressionhand-coded function object
x240230
x*x340350
x*x*x770760
x*x*x*x11801210
x*x*x*x*x19501910

Table 4. Test 2. ˼ǵҤѼȡ compose2 bind1st ʤɤѤ STL ̵̾ؿǵҤѼȡ μ񤭤δؿ֥ȥ饹ǵҤѼ CPU ֤ӡ BLL θդѤС a b ϼ«ѿǤꡢx ϼͳѿǤ롣 Ƥѿ double Ǥ롣 ¹Ի֤ñ̤ŪǤ롣

expressionlambda expressionclassic STL expressionhand-coded function object
ax330370290
-ax350370310
ax-(a+x)470500420
(ax-(a+x))(a+x)620670600
((ax) - (a+x))(bx - (b+x))(ax - (b+x))(bx - (a+x))166016601460

Υ饤֥Ѥʤѥեޥ󥹤ΥƥȤϡ [Jär00] ˵ҤƤ롣

7.2. About compiling

BLL Ʊƥץ졼Ȥο¿κƵŪʥ󥹥󥹲Ԥᡢ ƥץ졼Ȥ̤˻ѤƤ롣 ΤȤ(ʤȤ)λĤΤȤ̣Ƥ롣

  • ʣʦ˼񤯤ȤǤƤ⡢ 餯ϤͤǤϤʤ Τ褦ʦ˼ΥѥˤϤΥɬפȤ ѥ뤬٤ʤäƤޤ⤷ʤ

  • 㤨ñʦ˼줿ȤƤ⡢˥ե󥯥ηԲIJǤ롣 ̾ץޤϦ˥ե󥯥ΤΤη򰷤ɬפʤ ˼ǥ顼ȯϡ ̾拾ѥϴط˥ե󥯥ηϤ롣 äˡѥ餬ϢΥƥץ졼ȤΥ󥹥󥹲ƤϤȡ 顼åĹʤꡢ̣򤹤뤳Ȥ񤷤ʤ롣

  • C++ ɸǤϡ̵ºƵθФΤˡ ƥץ졼ȤΥͥȤ 17 ؤޤǤƤƤ롣 ʣʦ˥ƥץ졼Ȥϴñˤ¤ۤƤޤ ¿ΥѥϤ꿼ƥץ졼ȤΥͥȤƤ뤬 ŪˤϡŪ¤夲륳ޥɥ饤ɬפȤ롣

7.3. Portability

BLL ϰʲΥѥư롣 ĤޤꡢΥѥ BLL ޤƥȥ򥳥ѥ뤹뤳ȤǤ롣

  • GCC 3.0.4
  • KCC 4.0f with EDG 2.43.1
  • GCC 2.96 (exception_test.cpp Τߥѥ顼ˤ꼺Ԥ)

7.3.1. Test coverage

ʲΥꥹȤϴޤޤƤƥȥեȡ 줾Υե뤬оݤȤ򼨤Ƥ롣

  • bind_tests_simple.cpp : ۤʤοȡоݤδؿΰۤʤ (ؿݥ󥿡ؿ֥ȡдؿ)Ф bind bind ˤؿι

  • bind_tests_simple_function_references.cpp : bind_tests_simple.cpp Ρоݤδؿؿݥ󥿤ǤȤ ˴ؿؤλȤȤäơƤΥƥȤ򷫤֤ bind_tests_simple.cpp ƤΥƥȤ򷫤֤

  • bind_tests_advanced.cpp : ͥȤ bind unlambdaprotect const_parametersbreak_const ΥƥȤޤࡣ ˥ե󥯥°Ȥ¾Φ˥ե󥯥Ϥ꡼ ؿ֥Ȥ֤ͤηꤹ뤿ˡƥץ졼 sig Ѥƥ

  • operator_tests_simple.cpp : ñࡢλѱ黻 ӥåȱ黻 ӡ 黻 󥯥ȡǥȡ ź ɥ쥹黻 ȤϤ ޱ黻 Ȥ˼Τ˥Сɤ뤹٤Ƥα黻ҤȤƥȡ եȱ黻ҤǤΥȥ꡼ߥ󥰡û黻ҤǤΥݥ󥿻ѤΥƥ Ԥ롣

  • member_pointer_test.cpp : Фα黻ҤؤΥݥ󥿤ʣʤΤǡƥȥե̤ˤ

  • control_structures.cpp : 롼פ if ʸι¤Υƥȡ

  • switch_construct.cpp : ƤΥݡȤ switch ʸ ΰο default ξ礬뤫ɤΥƥȤޤࡣ

  • exception_test.cpp : catch ֥åοѲʤ顢 try/catch Τ㳰ФƥȤޤࡣ

  • constructor_tests.cpp : constructordestructornew_ptr delete_ptrnew_arraydelete_array ФƥȤޤࡣ

  • cast_test.cpp : ͤĤΥ㥹ȼΥƥȡtypeid sizeof ΥƥȤޤࡣ

  • extending_return_type_traits.cpp : 桼Τ֤ͤηƥγĥΥƥȡ ĤΥ桼α黻Ҥȡ бü첽Τ֤ͤηƥץ졼Ȥޤࡣ

  • is_instance_of_test.cpp : Ū˻Ѥƥץ졼ȤΤΥƥȤޤࡣ ƥץ졼ȤϡͿ줿ƥץ졼ȤΥ󥹥󥹤ɤ򸡽Ф롣

  • bll_and_function.cpp : ˥ե󥯥 boost::function ˤ褦ƥȤޤࡣ