github.com/google/skylark@v0.0.0-20181101142754-a5f7082aabed/testdata/benchmark.sky (about)

     1  # Benchmarks of Skylark execution
     2  
     3  def bench_range():
     4    return range(200)
     5  
     6  # Make a 2-level call tree of 100 * 100 calls.
     7  def bench_calling():
     8    list = range(100)
     9    def g():
    10      for x in list:
    11        pass
    12    def f():
    13      for x in list:
    14        g()
    15    f()
    16  
    17  # Measure overhead of calling a trivial built-in method.
    18  emptydict = {}
    19  range1000 = range(1000)
    20  def bench_builtin_method():
    21    for _ in range1000:
    22      emptydict.get(None)