thx for the pointer, I'll change the constructor then On 21-Jan-08, at 5:06 PM, Zed A. Shaw wrote:
> On Mon, 21 Jan 2008 19:12:06 -0200 > "Luis Lavena" <[EMAIL PROTECTED]> wrote: > >> No, he removed them: >> >> http://pastie.caboo.se/141633 >> >> The ragel code will generate the http11_parser.c file, and http11.c >> file defines all the functions pointers: > <snip> >> Theory indicates that allocation happens way before the ragel code is >> getting executed, so there is no need to evaluate the conditions all >> the time, ending with a speed boost. > > That's bullshit. All of those tests are simple checks to make sure > that you aren't passing in NULL pointers (which happens when the lib > is > used generally). Removing those would be a tiny little impact on the > performance since they're written in raw C. Only reason that'd speed > things up is if the compiler wasn't doing its job right (which is > possible). > > It's also a performance *loss* in that a user of the library has to > set > all callbacks always (or get a crash) and then every function is > called > even if a user of the lib only cares about a particular piece. > > Also, what's happened is now the safety checks against invalid input > are gone too. Any of those actions could fire in the parser section > and if those variables are not set then the whole program will eat it > bad. > > That's a very bad design change, and now I wish I'd gone to the dude's > demonstration so I could tell him. > > If someone wanted to optimize this just for the case where every > function is used and always set, but not lose safety then they should > change the constructor to the library to require those functions > always > be set. Then you could remove the if-statements. > > -- > Zed A. Shaw > - Hate: http://savingtheinternetwithhate.com/ > - Good: http://www.zedshaw.com/ > - Evil: http://yearofevil.com/ > _______________________________________________ > Mongrel-users mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/mongrel-users _______________________________________________ Mongrel-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/mongrel-users
