Okay.  So, I'm using the jquery star rating plugin from the following
link.

 http://www.fyneworks.com/jquery/star-rating/#tab-Background

I had horrible performance issues when running more than a few
( 3-4+ ) star ratings WITH split stars on the same page.  I went
through the code and determined that it was the following line from
the code that process the split star math.

var stw = ($.fn.width ? $(eStar).width() : 0) || settings.starWidth;

I was suprized to find that this line caused the problems.  I was sure
it was the math.  See the full section of code that this is from
below.  By process of elimination I determined that this ternary
operator line was causing the entire page to render about 7-9 times
slower ( 8 seconds versus barely one second ).  Anybody know why this
line sux?  Seems harmless enough to me.  BTW, I simply modified it to
use the settings.starWidth directly.


if(typeof settings.split=='number' && settings.split>0){
                                var stw = ($.fn.width ? $(eStar).width() : 0) ||
settings.starWidth;
                                var spi = (i % settings.split);
                                var spw = Math.floor(stw/settings.split);
                                $(eStar)
                                // restrict star's width and hide overflow 
(already in CSS)
                                .width(spw)
                                // move the star left by using a negative margin
                                // this is work-around to IE's stupid box model 
(position:relative
doesn't work)
                                .find('a').css({ 'margin-left':'-'+ (spi*spw) 
+'px' })
};

Reply via email to