Skip to content

Instantly share code, notes, and snippets.

@RiseInRose
Created October 23, 2018 05:59
Show Gist options
  • Select an option

  • Save RiseInRose/d4ddc230bff4e94ee9cf14cfa75f6adf to your computer and use it in GitHub Desktop.

Select an option

Save RiseInRose/d4ddc230bff4e94ee9cf14cfa75f6adf to your computer and use it in GitHub Desktop.

Revisions

  1. RiseInRose created this gist Oct 23, 2018.
    29 changes: 29 additions & 0 deletions python 效率测试
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    # author caturbhujadas_pc
    # date 2018/10/23 13:31
    # wechat chending2012
    from time import time
    from numba import autojit
    i = range(10000000)

    # @autojit()
    def do(each):
    # str(each)
    each += 1
    # int(each)
    # each*each

    t1 = time()
    for each in i:
    do(each)
    print(time() - t1)

    t3 = time()
    [do(each) for each in i]
    print(time() - t3)

    t2 = time()
    map(do, i)
    print(time() - t2)