sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

201903-builtin-echo.sh (728B)


      1 #!/usr/bin/env bash
      2 
      3 if [[ ! ${BLE_VERSION-} ]]; then
      4   source ../../src/benchmark.sh
      5 fi
      6 
      7 function echo.normal {
      8   echo hello
      9 }
     10 
     11 function echo.builtin {
     12   builtin echo hello
     13 }
     14 
     15 function ble/builtin/echo1 {
     16   builtin echo "$@"
     17 }
     18 function echo.function1 {
     19   ble/builtin/echo1 hello
     20 }
     21 
     22 function ble/builtin/echo2 {
     23   builtin printf '%s\n' "$*"
     24 }
     25 function echo.function2 {
     26   ble/builtin/echo2 hello
     27 }
     28 
     29 ble-measure echo.normal
     30 ble-measure echo.builtin
     31 ble-measure echo.function1
     32 ble-measure echo.function2
     33 
     34 function ble/print {
     35   builtin echo "$@"
     36 }
     37 function echo.functionS {
     38   ble/print hello
     39 }
     40 
     41 function ble/p {
     42   builtin echo "$@"
     43 }
     44 function echo.functiont {
     45   ble/p hello
     46 }
     47 
     48 ble-measure echo.functionS
     49 ble-measure echo.functiont