Not feeling the flog…

Discussion in 'Ruby' started by Austin Ziegler, Nov 17, 2007.

  1. I don't think that I'm really understanding the value of flog. Heckle, I
    get. What am I supposed to do with a report like this:

    Total score = 2264.64752355478

    RGB#none: (486.2)
    169.4: freeze
    160.6: new
    135.5: lit_fixnum
    9.9: from_percentage
    6.0: sclass
    4.8: alias
    [snippage]

    What does this really tell me?

    -austin
     
    Austin Ziegler, Nov 17, 2007
    #1
    1. Advertisements

  2. Austin Ziegler

    Eric Hodel Guest

    Total complexity of your project is 2264ish. 20% (486/2264) of your
    complexity lies in RGB, and I'm guessing that its all building up
    your constants (from the names in your report).

    What does `flog ... | grep -v '^ '` give (just the top-level stuff)

    For RubyGems:

    Total score = 7318.5427518653

    Server#run: (203.9)
    OpenURI#open_http: (161.0)
    Policy#verify_gem: (135.9)
    main#none: (118.0)
    Validator#alien: (105.8)

    Server#run is a good candidate for refactoring (3% of complexity!),
    as is Policy#verify_gem (2%!). main#none is just toplevel code.
    (OpenURI is in there for fixing proxy stuff :/)

    Note: values are an arbitrary, they only matter relative to the
    total, and relative to other modules or methods.
     
    Eric Hodel, Nov 17, 2007
    #2
    1. Advertisements

  3. Pretty much.
    Total score = 2306.67251009945

    RGB#none: (486.2)
    AdobeColor#initialize: (226.8)
    AdobeColor#to_aco: (125.4)
    RGB#to_hsl: (76.0)
    HSL#to_rgb: (75.8)
    MonoContrast#regenerate: (70.0)
    CMYK#to_rgb: (54.9)
    Metallic#none: (40.6)
    Gimp#initialize: (38.2)
    AdobeColor#readwords: (34.2)
    RGB#to_cmyk: (33.9)
    CMYK#==: (32.2)
    HSL#mix_with: (32.0)
    RGB#from_html: (30.0)
    AdobeColor#readutf16: (29.7)

    I think I'm getting it now. Inasmuch as the reported complexity
    indicates the likelihood of harder to understand code or potentially
    slower code, the percentage of complexity makes a difference.

    Not a lot of value for the project I'm flogging right now (the
    successor to color-tools that will be used in the upcoming PDF::Writer
    1.1.4). Thanks.

    -austin
     
    Austin Ziegler, Nov 17, 2007
    #3
  4. Ah ... so it's a "complexity profile". Couldn't flog display its report
    with percentages and cumulative percentages? So, for your example, you'd
    get:

    Total 7318.54 Percent Cumulative
    Server#run: 203.9 2.79% 2.79%
    OpenURI#open_http: 161 2.20% 4.99%
    Policy#verify_gem: 135.9 1.86% 6.84%
    main#none: 118 1.61% 8.46%
    Validator#alien: 105.8 1.45% 9.90%

    ...
     
    M. Edward (Ed) Borasky, Nov 17, 2007
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.