Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 35 made on Tuesday April 27, 2010 at 18:31
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
Dominic, as you've previously stated that you'd like to contribute I've send my unprotected sources to you so that you can see what I did and how I did it so you can improve your code (you and Philips are the only onces that have that sources). Could you atleast send some snippets back so I can see some differences and improve mine and can comment on your code? As requested with my code I'll keep yours private aswell.

Besides that, ofcours I'd like to beta test your protected version.

Lyndel, when Philips (Koen B) checked my sources they commented that it would improve performance when all sub functions would be moved out of onData and would sit on their own. Not sure if it helps you, but maybe it's usefull.
Other ways that I'm improving my modules is by testing loops with if then else and case. (Generally speaking case is faster, but when nesting case it often is faster to switch one to if else if) I also try to do as much as possible only once on page load, including GUI.widget.
And less lines of codes is generaly better, but sometimes it helps to not put everything in sub functions but copy them in.
Someways of coding also seem to be running a bit faster:
this.SendKey = {
key_return:function(){self.Command("Sendkey(1)");},
key_enter:function(){self.Command("Sendkey(2)");},
};
[...]

is faster then:
this.SendKey = {};
this.SendKey.key_return = function(){self.Command("Sendkey(1)");};
this.SendKey.key_enter = function(){self.Command("Sendkey(2)");};
[...]

Less libs also seems to help, also not using httplib makes a huge difference (when you only need basic communication). If I don't need return values I just do a socket.write without onData.
Things that I do not have to poll constantly, (like the time I can calculate it back to a starttime and do a datediff with a scheduleafter to update) I poll as less as possible and when I need to poll multiple items I use multiple sockets (but not with Denon, which doesn't support that). When not using HTTP try to poll multiple items before closing the socket, even with multiple remotes you will get a higher average commandrate. When using multiple remotes try to optimise your timers so that all remotes find their own hole in the minute, so they don't have to wait on each other.
Not using (or as little as possible) constructor functions (those that you call with new) speeds things up really well. I only use them on page load except for new Image and a few others which I can't do without.
Also do not use GUI.updateScreen or System.delay.

The optimalisations above made my XBMC module fly. It's extremely fast now, before these it was ok-ish. I really hope I'm able to finish it up soon so I can do the same kind of rewrite on my Denon Player and Receiver modules.

And if you think TCP/IP with Denon is trouble, try to do the same with RS232, after that you'll feel a lot better. :)

Last edited by sWORDs on April 27, 2010 19:03.


Hosting Services by ipHouse