NetTalk Central

Author Topic: Windows CE, very slow  (Read 6749 times)

mjost

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Windows CE, very slow
« on: September 06, 2012, 11:42:49 PM »
Hello !

I've started a project with NetTalk 5.44 for a handheld terminal with barcode scanner which runs Windows CE 5.0 and Internet Explorer over a WiFi wireless network.
I started with a Calculator(34) example which I simplified to one entry field and one display field.

When I tested the app on the terminal it was unacceptably slow. I compared the traffic in the server log between connecting to the app from handheld terminal and from a PC.
- from a PC there were only one POST and two GETs and everything was very fast
- from a terminal there were one POST and about 30 GETs everytime loading everything like when the first time connected: all scripts and styles. It can take up to 10 seconds to update the page

What can be done here?

Best regards.
                               Matjaz Jost



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Windows CE, very slow
« Reply #1 on: September 07, 2012, 12:15:56 AM »
Hi Matjaz,

First I suppose it's worth pointing out that the performance of web browsers have improved by orders of magnitude since the Windows CE / IE4 days. (The IE you're using probably says IE6, but the engine in Windows mobile is actually IE4). Plus the device itself is probably quite slow by today's standards, so even if everything else is right that is probably a bottom boundary on what is possible.

It's entirely possible that IE4 may even be unable to run the site at all. For most Windows Mobile devices (which came _after_ Windows CE), the Opera Browser was necessary for complete JavaScript support.

From your report it sounds to me like you don't have compress / combine turned on in the WebServer procedure. This will make a big difference to the load of the page. Equally, it sounds like you might not have caching on the device, and that really will slow it down a lot. If caching is on it only needs to get the Js and Css once - so the first page load is slow, but then it's quicker after that.

Incidentally NT6 is faster than NT5 as well, so there'd be some difference there.

While there are things you can do, I think there are probably limits to what you can achieve with a CE / IE setup.

Cheers
Bruce




mjost

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Windows CE, very slow
« Reply #2 on: September 07, 2012, 03:44:35 AM »
Hello Bruce !

I turned the compress / combine on and is a little better but it's still loading everything and therefore slow (about 4 seconds for every screen). I couldn't find the settings for cache in the IE yet.
About Opera: which version would be OK for WinCE? I was somewhat confused when checking their website.
The company that I'm doing the project for has numerous such terminals running eneterprise software like SAP with normal speeds. How are they doing it? Without JavaScript and CSS?

Best regards.
                             Matjaz Jost

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Windows CE, very slow
« Reply #3 on: September 07, 2012, 05:43:45 AM »
>> About Opera: which version would be OK for WinCE? I was somewhat confused when checking their website.

I've no idea. I guess you'd need to research that. I know Wolfgang though had a lot of success with Opera on Windows Mobile devices some years ago.

>>  How are they doing it? Without JavaScript and CSS?

yes exactly. It's very "web 1.0" - basically using plain HTML (and usually not a lot of it) along with no JavaScript, and minimal, if any, CSS.

Now of course nothing stops you making pages that your server serves that does exactly that - ie plain HTML with no CSS or JavaScript. If all they're doing is a simple capture then it's probably easy to make a custom page for them that does that. If however they want to do more exciting things - ie the things your other users are used to, then some experimentation with the Opera browser is probably the first road I'd select.

cheers
Bruce


mjost

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Windows CE, very slow
« Reply #4 on: September 10, 2012, 02:48:18 AM »
Hello Bruce !

What would I have to do to switch the jQuery and css off and use NetTalk as an engine to work with plain HTML (web 1.0 as you say)?

Best regards.
                                Matjaz Jost

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Windows CE, very slow
« Reply #5 on: September 10, 2012, 05:19:43 AM »
just make static html files in the web folder.
ie you're not gonna be able to use the browse and form templates, but you can do manual html.
Yes, it's a lot more work though - and not nearly as interactive - and you'll need to learn some html along the way as well, so it's not an ideal situation. But if you need to support pre-historic hardware then I guess it is what it is.

I'd recommend doing it only if you have one or two pages to support on the device.

cheers
Bruce

mjost

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Windows CE, very slow
« Reply #6 on: September 17, 2012, 01:46:33 AM »
Hello Bruce !

I've decide to go this way. I can really do my project with 2 or 3 pages.
My idea is to parse the static .htm files and insert necessary data to them just before they are sent back to client . It looks to me that I could do all this in the WebHandler procedure alone. But after digging in the docs including the book 'Building Web Apps...' and trying with code I couldn't find the right way. So my questions:
- Is my idea OK
- In which embed to do my parsing: after the page is read from disk and before sending it to the client
- In which variable (property) is the text that is then sent to the client
- Where can I get the IP address of the client

Thank you for helping.
Best regards.
                            Matjaz Jost


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Windows CE, very slow
« Reply #7 on: September 17, 2012, 02:33:25 AM »
>> My idea is to parse the static .htm files and insert necessary data to them just before they are sent back to client .

yes, you can do this. Given that you want to stay away from Browses and Forms, you will want to check out the Example 47 (Pages) and "embed" NetWebSOURCE procedures in the static pages using that technique. In the book read the section on "serving static pages with dynamic content".

Creating the HTML is of course only half the battle, and the easy half at that. the problem is not displaying the pages, the harder work is in processing the POST's that'll come back from the client. But let's do one step at a time...

>> Where can I get the IP address of the client

you don't need this. Sessions still exist, so session variables still exist, and so on. Everything is really still working, it's just Browses and Forms that you don't have access to.
(If you really want the Ip address it's in p_web.requestdata.fromip, but if you're finding that you need this then you are probably making things more complicated than they need to be.

cheers
Bruce

mjost

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Windows CE, very slow
« Reply #8 on: November 08, 2012, 02:10:24 AM »
Hello Bruce !

I'm back with my project for Windows CE where I don't want't to have javascript because it is slow.
I've made a small framework of 6 static pages and a nettalk app which serves them. I've found that if I have the <!-- NetWebServer --> tag included in any of the pages the whole jQuery framework is loaded which is exactly what I don't want. Without <!-- NetWebServer --> tha pages are served fast and OK.

The problem is that I can't find where (to which embed) to place my parsing code. It should be somewhere where the page is loaded to a string, which I would parse and then let it again to be sent to the client. ?

I've found the client IP address where you told me. It can be useful for me because I will have a fixed number of clients with known IP addresses - the handheld terminals in the customer's company network. I will probably use it instead of sessions or some other differentiation of clients.

I hope you will help me to the end - till I get my project work.
When I'm finished I will publish the basic framework open if anybody finds it useful.

Best regards.
                               Matjaz Jost

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Windows CE, very slow
« Reply #9 on: November 08, 2012, 05:07:29 AM »
Hi Matjaz,

>>  I've found that if I have the <!-- NetWebServer --> tag included in any of the pages the whole jQuery framework is loaded which is exactly what I don't want. Without <!-- NetWebServer --> tha pages are served fast and OK.

it's more likely the <!-- Net:c:head --> tag which includes the CSS and JavaScript files. They're not included by the <!-- NetWebServer --> comment.

>> The problem is that I can't find where (to which embed) to place my parsing code.

I'm not sure what you mean by "parsing code". I presume you are wanting to embed things on the page? What sort of things?

I think all you need to do is create NetWebSource procedures, and then embed them on the page using
<!-- Net:functionName -->

they'll get called automatically when the page is parsed.

Of course you won't be able to embed browses or forms 'cause they use JavaScript.

cheers
Bruce

mjost

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Windows CE, very slow
« Reply #10 on: November 09, 2012, 02:41:41 AM »
Hello Bruce !

Thank you for the answer. This was now the major breaktrough for me.
Yes, the Javascript is bound to Net:c:head.

I thought I would have to parse the whole .htm file to insert my own html code. Now I understand the trick with Net:FunctionName and can start the real work with my app.
I will basically get the scans from terminal and then embed the data from server based on the scan to another page displayed on the terminal.

When digging through code I've found that every call to SendPacket routine sends a separate packet to the client. There can be many SendPackets for one page. Doesn't this slow the communication?

Best regards.
            Matjaz Jost

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Windows CE, very slow
« Reply #11 on: November 09, 2012, 08:14:40 AM »
Hi Matjaz,

>> When digging through code I've found that every call to SendPacket routine sends a separate packet to the client. There can be many SendPackets for one page. Doesn't this slow the communication?

yes, and no. Remember a SEND only sends it as far as the NetTalk DLL. Then it goes to the Winsock DLL. Then to the ethernet driver. Then through a bunch of routers. Then all the way up the stack at the other end. At any of those points packets can be amalgamated and /or split apart. So there's not a lot of real relation between the "packets" you send and the "packets" the client receives.

That said, yes there are cases where sending it in one lump may be faster.

On the other hand, the sooner you start sending, the more gets transported to the client while you're figuring out the rest. So in practice it can vary a lot depending on what is on the page.

In the real world though, this approach doesn't make a lot of difference one way or the other.

cheers
Bruce