Coffeehouse Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Perf Wiki on Channel 9

Back to Forum: Coffeehouse
  • User profile image

    Rico Mariani has created a perf wiki on Channel 9!

    This is the place to get all the info you could want on how to write highly performant code in the memory managed, object oriented world.

    Thanks Rico!

  • User profile image
    Dr. Shim

    Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you!

    Very thankful,
    Dr. Shim

    (Did I mention I was thankful?)

  • User profile image

    Good work my man!

    I've been hoping for something like this -- good tips under one roof.


  • User profile image
  • User profile image

    I've got a question for Rico about one of his performance quizzes, if he's still watching.

    I've got this code that replicates (I think) the Rad Parser of
    "Performance Quiz #3" in which it takes 1.092s to parse the 2500 line text file.

    However, when I use this code, its equivilent in Boo (I think!),
    import System
    import System.IO

    start = DateTime.Now
    stream = StreamReader("""C:\temp\quiz.txt""")
    line = ""
    delims = (' '[0], '\t'[0])
    sum = 0

    while (line = stream.ReadLine()):
        fields = line.Split(delims)
        for field in fields:
            sum += int.Parse(field)
    print "The total number of the ints is ${sum}"
    print "This took ${DateTime.Now - start}"

    I get this output:

    The total number of the ints is 766085000
    This took 00:00:00.0300432

    The completion time is variable, of course, but it never goes beyond 0.4 milliseconds.

    Since C# and Boo are relatively the same, performance wise, why is my version so much faster than yours? Am I measuring the elapsed time the wrong way, or did I neglect a function call or something?

  • User profile image

    And, just for comparison, the verbatim (copied and pasted) "Classic Parser" results, determing the run-time in the same way as the Boo sample, which was basically DateTime math.

    "The total of the ints is: 766,085,000
    Runtime: 00:00:00.0100144"

    The difference is not so large. Why for, dah?

  • User profile image

    When I did the timing I timed the entire run from start to exit of the program so that includes all the time to load the JIT and to read the metadata necessary for jitting.  If you put the measurements in the program the you don't count (some) of the jitting time.  I don't know how your language converts to IL for jitting.  Maybe it all looks like one function?

    In this case, the RAD parser uses a lot more classes so that's probably a good bit of the code. The funny thing is that I thought that would give it more of an edge but in retrospect that's not likely true at all.

    In any case, the time analysis was very rough.  Mostly I wanted to talk about space, hence the space details.

    I guess the other thing is, it seems to be showing a 3x difference in your measurements, is that about right?  Subtracting out the jit time that might be just about right.  And of course have different machines with different cache (and hence gen0) sizes.  All of that matters too...

    Did I mention that my articles are only approximately correct? Smiley

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.