javascript - Angularjs: `$applyAsync` vs `$apply` with sockets -
i use sockets , lot of messages server. there handler every socket message , invoke $apply
in every handler. better performance use $applyasync
instead of $apply
if there lot of messages , if so, why? frequent invoking of $apply
makes app slow.
unless you're receiving more 1 message every 4ms ( minimum resolution of settimeout
in modern browsers ), it's unlikely you'll see performance improvement - in fact might find performance degrades touch additional timers added , fired. if receive many messages, may find helps since batch processing single digest cycle.
without knowing socket it's hard make solid suggestion, aggregate data socket receiving , digest every n updates or throttle digests occur every 500ms or that?
Comments
Post a Comment