Giter Club home page Giter Club logo

Comments (3)

emeryberger avatar emeryberger commented on May 18, 2024

Can you post your program testpy.py? I just verified that Scalene does work with arguments passed to the profiled program. Here's a test case.

    import argparse
    
    parser = argparse.ArgumentParser(description='Process some integers.')
    parser.add_argument('integers', metavar='N', type=int, nargs='+',
                       help='an integer for the accumulator')
    parser.add_argument('--sum', dest='accumulate', action='store_const',
                       const=sum, default=max,
                       help='sum the integers (default: find the max)')
    
    args = parser.parse_args()
    for i in range(1000000):
        pass
    print(args.accumulate(args.integers))

    % python3 -m scalene testargs.py --sum 12 13 14
    39
    testargs.py: % of CPU time = 100.00% out of   0.04s.
           |    CPU % |    CPU % |   
      Line | (Python) | (native) |    [testargs.py]
    --------------------------------------------------------------------------------
         1 |          |          | import argparse
         2 |          |          | 
         3 |          |          | parser = argparse.ArgumentParser(description='Process some integers.')
         4 |          |          | parser.add_argument('integers', metavar='N', type=int, nargs='+',
         5 |          |          |                    help='an integer for the accumulator')
         6 |          |          | parser.add_argument('--sum', dest='accumulate', action='store_const',
         7 |          |          |                    const=sum, default=max,
         8 |          |          |                    help='sum the integers (default: find the max)')
         9 |          |          | 
        10 |          |          | args = parser.parse_args()
        11 |   87.99% |   12.01% | for i in range(1000000):
        12 |          |          |     pass
        13 |          |          | print(args.accumulate(args.integers))

from scalene.

emeryberger avatar emeryberger commented on May 18, 2024

bump @josefwilfinger

from scalene.

josefwilfinger avatar josefwilfinger commented on May 18, 2024

hi. i am sorry. i dont know why, but now it works. i tried several times, before i wrote this. but now it works. sorry

from scalene.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.