-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [EMAIL PROTECTED] wrote: > I posted this in the spinoffs group as until 5 minutes i go i did'nt know > this existed. a FYI on the prototypejs.org website the mailing list url > points there, not here. > > Please read this: > http://groups.google.com/group/rubyonrails-spinoffs/t/2c64e213e3d0f0df?hl=en > and possibly comment if you think my suggestions are worthy or not :)
OK, you got it. Let's continue.. ;-) Mislav wrote: >> Wouldn't it make even more sense for instance to skip doing all these >> checks? How? By dynamically compiling different versions of those >> methods based on the capabilities of the browser running them. ;-) > > Well, duh! ;-P see http://dev.rubyonrails.org/ticket/6696 OFC, that's what I was talking about, now hopefully Malard (or is it "Martin"?) understands what I meant ;-) Malard wrote: > How can you detect different versions of the browser dynamically and > compile them. You can easily change the user agent value that the browser > sends to the server, but you cant change if certain parts of the > javascript engine exist or not. So i'm pretty confident that javascript > based checking is the only way to go. Check out the URL Mislav pointed out. It's the (very) basic technique (yet very efficient) I was talking about. So, the only issue still standing in this paragraph is "how to detect different versions". People [1] think the right choice is not "browser detection", but "object detection". This is a very weary subject, I don't really want to reiterate it. FWIW, I'll just say Prototype folks did the (almost) right thing by never-saying-never (to "browser detection") and you have seen examples right in "setStyle" (kludging "opacity" with "filter" for all versions of MSIE, or choosing to replace "full opacity" - 1 - with 0.999999 for all Geckos). Yes, it's a real PITA, but we really have to deal with all these annoying bugs. I'm sure there are better ways, we just have to discover them. So, please help us ;-) Martin Ellis wrote: > The quote you made, was not from myself. I don't really know if it's Mislav's fault as I've seen many such misplacements from Google Groups infrastructure. Sorry, no example at hand, AFAIR there were various differences in threading order when browsing NNTP group using Google Groups comparing to other NNTP clients :( > I dont believe that the web server should decide how to serve the > javascript. I really hope you got it right this time. I NEVER said that. By all means, I know my English is very poor, but is it THAT lousy as to make people think I really say such aberrations? :)) > As for optimisations, you use include alot, its incredibly expensive to > use that function when just looking for 2 items in array. As a general principle, I, for one, am completely against premature optimization, even when done properly (meaning: really well argumented/commented), but I can understand (and favor) micro-optimizations. So, now that hopefully you know how to contribute to this project [2], please do try promoting such micro optimizations through patches (+ tests, benchmarks, etc - when necessary), I'm sure Prototype team would like that. > Do you think instead of just using rubyesque functions for the sake of > using them over performance is the best action to take, or should code > used in prototype use the fastest applicable. Depends on your purposes. Now that you mentioned "ruby", AFAICT ruby folks don't give a rat's ass about performance (yet), they want to create an elegant programming language. Performance? Later on, they're still young. Maybe that is (should be) the case with Prototype too ;-) > I was doing some tests, and the cheapest way to do this was to use an if > statement, i.e if (foo === 'bar' || foo === 'bar2') {} This is a good example of micro-optimization but also a good example of premature optimization :)) Good: it's very fast [3] Bad: maintenance is nightmare (when "foo" will accept more and more and more values) ;-) [1] http://www.quirksmode.org/js/support.html [2] http://prototypejs.org/contribute [3] http://gfx.neohub.com/benchmark/t/isin.html cheers - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFF2JlWtZHp/AYZiNkRAvLXAKD5cRxK4+d9yHIJpWQnBVxL5JAk1wCbBYnm AT6bT8AN5k4vZNGs2EucqQ0= =qexU -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---
