Hide/Unhide or dynamic alloc - faster?

Hi all,

I was wondering, which is better for performance? Dynamically adding to the display of the web app or using the visibility flag? I’m not sure how visibility is handled between the server and the client, so before I look at doing a major re-write I was hoping to get some input. Right now I’m using dynamic insertion into the page as certain buttons are pushed as data is displayed differently depending on the control selected. I have pre-built “sub-screens” that fill a region of the app display that I insert and remove as needed while the app is running. Would I ultimately be better off inserting the various custom sub-screens and hiding them and only updating what is displayed and then toggling the visibility of the one that actually needs to be displayed (instead of adding/removing the panels during the runtime via new and embedwithin)?

Visibility is underlying a simple property of the HTML element. It must be way faster than embedding.

EmbeddingWebContainers is convenient if you have entire sets of controls to display.

If speed is critical, then use preferably visible.

Well, it’s not as much that it’s “crucial”, there are just some things that don’t feel quite as responsive as I wold expect considering what it is doing. I’ll have to dig some more to make sure I haven’t got any bad code mixed in, but I’m thinking visible/invisible may be the path I end up having to migrate the project to.

Thing is, AFAIK, embedwithin requires moving the entire structure from the server to the browser. With any relatively slow connection, it will be WAY slower than simply setting up a flag.

If you already see sluggishness, by all means, switch to visible.

You can also mix methods, depending on what you need. Oddly enough, implicit webpages display quasi instantly because they are preloaded in the browser. Embedding big WebContainers will be much slower, because they have to be loaded. That is another venue to consider.

ugh, wish I could go back and edit my post - just noticed that I fat fingered “would” into “wold” lol. Oh well.

I converted my project over to using the visible flag. makes looking at the layout a bit ugly, but it seems to be working better.

You mention “implicit webpages”, do you mean creating additional separate pages in the project and showing/hiding them can offer potentially better performance than embedding extra controls or objects into the existing webpage? (granted, for this app it probably wouldn’t have worked out well as I wouldn’t wan’t certain controls flickering as pages were being changed, but for future projects…)

Yes, that is what I meant.

All implicit instantiated webpages are preloaded at the start of the session. That makes displaying them extremely fast, as part of Xojo Web underlying magic. Chances are displaying a preloaded webpage is much faster than instantiating and embedding a big WebContainer. With small WebContainers, the difference is probably negligible. And still, I believe using visible probably is faster, since the HTML element is already there.

On desktop, using Windows or ContainerControls is pretty much equivalent. On Web, that structural difference can mean a big difference on slow Internet connections.

Controls flickering can be alleviated by starting them invisible, and making them visible when they are fully formed.

Because pushing data to the browser is time consuming, Xojo Web is kind of an art sometimes.