2012. december 12.

Kategóriaelmélet és jQuery

A kategóriaelméletet a közkedvelt meghatározás szerint "general abstract nonsense". Ez persze korántsem jelenti azt, hogy nem lehet gyakorlatias dolgokra használni eredményeit. Pl. John Bender egészen zseniálisan alkalmazta az ún. loop fusion technikát a jQuery-ben. De hogy kerül a csizma az asztalra? Bender working paper-je így foglalja össze:

The jQuery JavaScript library, used on more than 55% of Alexa’s top 10,000 websites makes the manipulation of HTML documents easy and intuitive through fluent method chaining and an intuitive API design. An unfortunate side effect of these user friendly features is that they often incur an otherwise unnecessary performance overhead. While JavaScript execution in desktop browsers has become fast enough to hide much of the problem, the growing complexity of HTML documents and the ubiquity of web enabled mobile devices continue to make performance an important concern when developing JavaScript applications. We address this issue by proposing a category theoretic view of the relationship between jQuery and the Document Object Model. From that view we derive a set of alterations to the jQuery library and demonstrate the performance benefits that result. Additionally we show how the second functor law suggests a set of JavaScript functions and jQuery methods that can be optimized using loop fusion.

 

Az alábbi videón teljesen érthető formában fejti ki vizsgálódásainak lényegét Bender. Érdemes a lejátszás előtt és után is elolvasni rövid posztját.

 

1 megjegyzés:

Unknown írta...

Why don't you write this in English?

Nincs erre túl nagy magyar nyelvű közönség, dude.