Benchmarking improvements in Xojo 2023r4

10 years ago I was talking about it, proposing it as “Alias”

The forum conversion broke it, here is it fixed and updated:

2 Likes

I like the proposed functionality, but not the name “alias”, because “alias” has other connotations, e.g. filesystem aliases. Better imo to just call it what it is, a macro. Let’s not follow the Xojo pattern of assuming customers are stupid, like when they decided “append” was too sophisticated a word for their users to understand.

4 Likes

Alias is “another naming, usually shorter, to call something”.

We had 2 necessities we could cover with 2 keywords, Alias and Macro

Those were very similar and at the inner workings it would be the basically the same engine.

A Macro should not care about semantics, just expand the code during the compilation and the compiler would provide errors AFTER its expansion and parsing, but the intention of Alias was letting the autocomplete working for aliased objects too, like:

image

So I made such choice:

Alias is a short name for something known by a large/complete/complex identity, or
Parametrized Alias, for short call something expanded to a large expression.

But I would accept having both, Alias and Macro keywords, if someone cares about it.

But it could make Xojo postpone the request even further, like “Two new keywords? That’s too much”!

So I tried comprised the request to a minimum.

2 Likes

You can already do this via a variable or property.

1 Like

Not this, something similar but inferior. It costs you memory, speed and extra indirection (adds to ref counting).

Variables solves it runtime, Alias solves it at compile time.

2 Likes

I think an alias would still require some of the work to be done at runtime as TextArea2 and possibly StyledText would be independent pointers which couldn’t be resolved at compile time.

2 Likes

Could you exemplify what you are talking about with some code? I can’t get what you are saying. Alias is something that does not exist at runtime, it produces just compiler info that will be used for substitution not producing extra “runtime helpers” as a temporary variables, as those that people uses to shorten code with a cost nowadays.

So, those 3 lines of code:

Alias v = myObj.otherObj
v.myVal1 = a
v.myVal2 = b

ends a runtime code exactly the same as those 2 lines:

myObj.otherObj.myVal1 = a
myObj.otherObj.myVal2 = b

It seems as the code generated is significantly quicker too. Did some testing on complex graphics and found that it had 2.13 times faster screen redraws compared to the same code compiled with an older Xojo version in my specific example. That’s impressive.

Update: https://tracker.xojo.com/xojoinc/xojo/-/issues/75169#note_568649 verified as bug.

1 Like

Apologies, I think I have misunderstood the point of your alias feature. I now understand that it isn’t some kind of dereferencing and it is just a coding shortcut and the compiler would just expand the alias.

Based on my previous experience, dereferencing into a local variable would be more efficient though.

1 Like

Well, for this being true, the compiler should be dumb not caching a reference in a register and reusing it efficiently for repeating references. Very possible. But probably LLVM fights against it.

This is not my experience on W11 - on a complex webpage it is taking over 4 SECONDS to select a control.

Currently experiimenting to see if this is a plugin problem or native Xojo.

1 Like

And is slower, faster or about the same as 2023r3.1?

All other releases show sub-second switch between controls.

I’ve opened the project on my M1 Mac Mini & performance is good.

Same (worse) on Windows 10 - now removing controls to see if there’s a specific culprit.

1 Like

Is this happening only with Web projects? Could you please create a new Issue with all the info you can provide, that will help us fix that IDE problem you’re experiencing.

For example, is it happening with one of the provided examples?

Thank you!

Can’t reproduce here. Selecting and removing controls in Eddie-Web and Desktop-Example seems not slower to me than before. Windows 10 on a real PC with Nvidia 4070 graphics.

But: If i duplicate the controls of the main window x4 then i see it getting slower. Indeed slower than in 2023r3.1. Far away from 4 seconds, maybe 0.25 to 0.5 seconds. But already too slow to layout the GUI, e.g. unintended moving of controls are happening.

Thanks for your input. I also tried with EE adding dozens of buttons to a webpage with little detriment to response times.

I’ve raised a bug with Xojo and attached a sample project which shows the behaviour. Can’t see any way to upload example here.

https://tracker.xojo.com/xojoinc/xojo/-/issues/75216 raised. Not sure if web only as have no others projects to test on.

Thanks.

2 Likes

Thanks for ticket and sample. Seems like setting the Enabled-Property of a WebCheckbox in your project to false is the cause of the slowness. If i set Enabled to true it’s fast again. But if i try to reproduce in EE or in a fresh project, no issue.

So maybe some project corruption?

1 Like