satyr / coco

Unfancy CoffeeScript
http://satyr.github.com/coco/
MIT License
498 stars 48 forks source link

compiler option: target platform #210

Closed aeosynth closed 11 years ago

aeosynth commented 11 years ago

say i'm building a mobile app, and have access to all the latest js features; i'd like to pass a flag to the compiler, telling it to use those features instead of shims

vendethiel commented 11 years ago

Good "shims" are usually faster than the native implems, I remember @jdalton 's talk about that.

aeosynth commented 11 years ago

so keep the fast shims

jdalton commented 11 years ago

To clarify, if you're using newer native methods, and then wanting to support browsers that don't have them, your shims should follow the spec. This will make them slower, but necessary if you are putting shims onto Array.prototype or other builtins.

To keep things speedy I've used utility methods instead that can opt-in to native use when it's proven faster for given environments. This allows me to avoid following spec so close that it hurts perf for fallbacks while getting the speed of native when it's relevant.

satyr commented 11 years ago

We quit simulating [].indexOf for similar reasons.

aeosynth commented 11 years ago

are there any shims coco uses which have worse performance than native methods? if not, this issue can be closed as pointless

satyr commented 11 years ago

are there any shims coco uses which have worse performance than native methods?

None atm I believe.

if not, this issue can be closed as pointless

Alrighty.

jdalton commented 11 years ago

If you point me to the file w/ the shims I can do a quick review as well.