Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick
bradfitz
lj_dev

BML Profiling

I rewrote the BML parser ... so much better now: smaller, cleaner, understandable, and commented!

Here are my profile runs:

Old -- what I started with. Profiling the expansion of 14 pretty large BML pages. Note that bml_block is at 50% ... ouch. This made me suspect my parser was bad, but bml_block is a pretty light function. Still ... what hurts is that 15% for do_line.

After, 1 -- with the new parser. little better. do_line is totally gone now... deleted that function. the parser is more iterative now than it was before. but why is bml_block still so high? oh, damnit --- i have an eval call in there for _CODE blocks.

After, 2 -- moved the eval inside a new function, eval_code, which bml_block calls. now you can see it's really the eval that's slow (which makes sense --- that's perl parsing the perl in the BML)

I'm not done yet, but I gotta go for a bit. I'll continue to post results as the night goes on. There's a lot of obvious stuff to fix still, but I really wanted to rewrite the parser first, since it was so ugly.
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments