1. >>>0 converts the number to an unsigned value. It is used for unsigned
comparisons and math operations where the sign matters like division. This
should have no effect on performance, but it does mean unsigned operations
use a little more code.

2. The d=e; duplication looks like an LLVM phi that happens to have the
same value on both paths. We should optimize that better. Can you provide
the source code for that function, maybe reduced to just contain that part
and enough code around it so optimizations don't remove it entirely?

3. The +-constant issue is something we could optimize better, but it only
matters for code size and only matters fairly little, I believe, so it's
never been a priority. But it is worth doing if someone is interested.

On Mon, Jan 16, 2017 at 5:59 AM, Sergey Solozhentsev <
[email protected]> wrote:

> Hi I have troubles with performance with my code. I looked into generated
> code for one function and found some strange places. My funtion is
> function zy(a,b){
> a=a|0;
> b=b|0;
> var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;
> q=i;i=i+16|0;
> m=q+4|0;
> n=q;
> o=c[a+4>>2]|0;
> k=c[o+16>>2]|0;
> l=k+-1|0;
> o=o+12|0;
> g=c[o>>2]|0;
> if((c[(c[g+(l<<2)>>2]|0)+60>>2]|0)>>>0<b>>>0)
> {
> i=q;
> return
> }
> p=a+12|0;
> d=c[p>>2]|0;
> a:
> do
> if(d>>>0<l>>>0)
> while(1)
> {
> e=d+1|0;
> if((c[(c[g+(e<<2)>>2]|0)+60>>2]|0)>>>0>b>>>0)
> break a;
> c[p>>2]=e;
> if(e>>>0<l>>>0)
> d=e;
> else
> {
> d=e;
> break
> }
> }
> while(0);
> e=c[g+(d<<2)>>2]|0;
> f=e+60|0;
> if((c[f>>2]|0)>>>0>b>>>0)
> {
> do
> {
> d=d+-1|0;
> e=c[g+(d<<2)>>2]|0;
> f=e+60|0
> }
> while((c[f>>2]|0)>>>0>b>>>0);
> c[p>>2]=d;
> j=e
> }
> else
> j=e;
> h=c[a+8>>2]|0;
> h=Ml[c[(c[h>>2]|0)+8>>2]&255](h)|0;
> g=c[j+52>>2]|0;
> if(!g)
> {
> d=c[p>>2]|0;
> if((d|0)==(l|0))
> {
> d=k+-2|0;
> c[p>>2]=d
> }
> n=c[j+56>>2]|0;
> m=c[f>>2]|0;
> jm[c[(c[n>>2]|0)+20>>2]&511](n,b-m|0,(c[(c[(c[o>>2]|0)+(d+
> 1<<2)>>2]|0)+60>>2]|0)-m|0);
> b=c[(c[o>>2]|0)+((c[p>>2]|0)+1<<2)>>2]|0;
> Fl[c[(c[a>>2]|0)+20>>2]&15](a,j,b,n,h);
> Fl[c[(c[a>>2]|0)+24>>2]&15](a,j,b,n,h);
> Fl[c[(c[a>>2]|0)+28>>2]&15](a,j,b,n,h);
> c[a+16>>2]=c[p>>2];
> i=q;
> return
> }
> else
> {
> e=a+16|0;
> d=c[p>>2]|0;
> if((c[e>>2]|0)==(d|0))
> {
> i=q;return
> }
> c[e>>2]=d;
> QI(h,g);
> jG(n,c[j+40>>2]|0);
> c[m>>2]=c[n>>2];
> EI(h,m);
> FI(h,j+44|0);
> i=q;
> return
> }
> }
>
> I wonder why it is used *b>>>0* and sometimes *b=b|0;* why is not only
> one variant used?
> also there are some optimization issues e.g. in code
> if(e>>>0<l>>>0)
> d=e;
> else
> {
> d=e;
> break
> }
> d = e is executed in any case. Why is it duplicated?
> Also my minus operation is replaced with +- operation. It increase file
> size of every minus opearation.
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to