Skip to main content
Topic: BBC Parsing (Read 38823 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: BBC Parsing

Reply #30

@Joshua Dickerson here they are ... Not many changes at all. 

I added some additional test cases to message.php so you will see those.  One of them required me to add back a bbc code so that unparsed_commas could be tested, TBH I'm not sure that functionality is needed at all anymore, did anything other than glow use it? I guess its harmless anyway.

Changed the percent diff calc, to be based on the "old" code cheated on the divisor = 0 since I'm lazy.  A -% means the old is faster, a +% means the new is faster.

Allowed it to output the HTML to the existing tag output (in TestOuput) just so I could see what that formatted output.

Added those micro optimizations to ParseBBC.php just to make your goal harder :P

Added additional functions to helpers as needed by the new test cases.
Last Edit: August 18, 2015, 04:34:11 pm by Spuds

Re: BBC Parsing

Reply #31

I don't know what you guys are doing but I'm glad that you are giving so much attention to speed.
If can be useful I can provide my login details to my linode vps where you can switch from php 5.4, 5.5 or 5.6 with just some clicks. I'm in holiday right now but I'll be back in a few days. Just let me know if could be useful for your tests
sorry for my bad english

Re: BBC Parsing

Reply #32

Cool. Taking a look at it now. Got a screw in my tire so I am going to run to get that fixed in a minute. I think I'm going to add the glow tag back in by using a hook. It would then be able to test that adding tags by hooks works. I was saddened that you didn't have as much fun as I did with the messages. It's a glimpse in to my mind as it goes throughout the day hehe

Re: BBC Parsing

Reply #33

QuoteI was saddened that you didn't have as much fun as I did with the messages
LOL yeah they were pretty bland, sorry about that :D .. but I did enjoy yours quite a lot !  Now if I had done them after my evening homebrew it would have been a different story  O:-)

Adding glow as a hook makes sense, I think thats the only type that is not tested but I need to do a second look.

QuoteI don't know what you guys are doing but I'm glad that you are giving so much attention to speed.
If can be useful I can provide my login details to my linode vps where you can switch from php 5.4, 5.5 or 5.6 with just some clicks. I'm in holiday right now but I'll be back in a few days. Just let me know if could be useful for your tests
Thank you.  If Josh needs another test area I'm sure he will be in contact.  And yes this function is one that we attempt to monitor very closely when we make changes.

Re: BBC Parsing

Reply #34

@Spuds, I updated the gist with your changes. You changed the constant for the tests - parse_bbc(). Going to rename it SpudsParseBBC.php and spuds_parse_bbc() and add different test options:

new parser vs parse_bbc() test
new parser vs parse_bbc() benchmark
Spuds parse_bbc vs parse_bbc() test
Spuds parse_bbc vs parse_bbc() benchmark
new parser vs Spuds parse_bbc() test
new parser vs Spuds parse_bbc() benchmark

And probably change the way I get the tests so when I add the regex parser it isn't more work.

Who is Nicolas Bonet? (I feel like this is going to become like "who is John Galt" but a joke)

Re: BBC Parsing

Reply #35

Looks like a couple of minor things were missed ... a repo would help  O:-)

I had changed time_diff_perc => time_diff_percent (sorry) so that has to be updated in BenchOutput, also looks like the new % calc was missed there.  Also I had two more minor updates to ParseBBC ... so those two files are attached. 

In the previously attached BBCHelpers there were a couple of stub functions that are needed for quotes and footnotes.  I did not reattach that file since its the same as the previous one, but the gist needs to be updated with those.

I like the idea of adding in the additional comparisons, be interesting to see if back porting some of the tweaks made a difference or not.  I still need to check our parse "type" coverage to make sure we have test cases for each.

QuoteWho is Nicolas Bonet?
Why do you ask?  What did I miss?




Re: BBC Parsing

Reply #36

One of the messages contains an autolink to his FB profile.

My monitor keeps shutting down and Vagrant/VirtualBox are having problems with Win 10 but I initialized the repo in PhpStorm. So, at least I'm tracking changes now.

Re: BBC Parsing

Reply #37

QuoteOne of the messages contains an autolink to his FB profile.
Taken from Mantis  O:-) Be sure to like them :P

Re: BBC Parsing

Reply #38

NiBo... :P
Bugs creator.
Features destroyer.
Template killer.

Re: BBC Parsing

Reply #39

Maybe I'll shamelessly add my LinkedIn profile for advertising lol

Re: BBC Parsing

Reply #40

LOL

Re: BBC Parsing

Reply #41

ROFL!

Why not a paypal account? :P
Bugs creator.
Features destroyer.
Template killer.


Re: BBC Parsing

Reply #43

Finally got it working with all of your messages. It added a ton of time to the tests but I finally wrangled it down. On 500 iterations, I am getting a difference of 0.61 seconds or 5.44%. That's completely negligible if we're parsing 500 crazy messages like these are.

I have to go away for the weekend so I am going to post this here. I have to leave in a few minutes so I don't have time to setup the Github repo.

Going with the iterative idea of this, before I switch all of my attention to the regular expression version, I want to change the codes array to use [1st char] => array([tag] => array(code, code, code...), tag => array(code) ) ). Also, instead of passing the disabled array to the validate/test functions, I want to pass the BBC object.

There a bunch of things I started working on so I don't forget them in the zip. I don't know if I applied all of your changes, but I purposefully skipped some of them.