~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to doc/manual/performance-tips.rst

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-11-17 19:32:52 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20131117193252-tkrpclguqqebqa35
Tags: 0.2.0+dfsg-3
testsuite-i386.patch: loosen the numerical precision for yet another test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
will raise a run-time error if the value is not of the expected type,
104
104
potentially catching certain bugs earlier.
105
105
 
106
 
Declare types of named arguments
 
106
Declare types of keyword arguments
107
107
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108
108
 
109
 
Named arguments can have declared types::
 
109
Keyword arguments can have declared types::
110
110
 
111
 
    function with_named(x; name::Int = 1)
 
111
    function with_keyword(x; name::Int = 1)
112
112
        ...
113
113
    end
114
114
 
115
 
Functions are specialized on the types of named arguments, so these
 
115
Functions are specialized on the types of keyword arguments, so these
116
116
declarations will not affect performance of code inside the function.
117
117
However, they will reduce the overhead of calls to the function that
118
 
include named arguments.
 
118
include keyword arguments.
119
119
 
120
 
Functions with named arguments have near-zero overhead for call sites
 
120
Functions with keyword arguments have near-zero overhead for call sites
121
121
that pass only positional arguments.
122
122
 
123
 
Passing dynamic lists of named arguments, as in ``f(x; names...)``,
 
123
Passing dynamic lists of keyword arguments, as in ``f(x; keywords...)``,
124
124
can be slow and should be avoided in performance-sensitive code.
125
125
 
126
126
Break functions into multiple definitions