haxeui / haxeui-core

The core library of the HaxeUI framework
http://haxeui.org
MIT License
340 stars 71 forks source link

ScrollView performance issue - very slow with ca. 160 entries #176

Closed sumo961 closed 3 years ago

sumo961 commented 6 years ago

Scrollview very slow with ca. 160 items. Openfl on OSX. Different Scollview used in the same way with fewer items works just fine.

Current Behavior

No error message, but clicking on the tap with the scrollview results in "spinning beachball" and several seconds wait time. This happens not only the first time the tap is clicked, but every time, as if the scrollview is recreated every time.

Test app / minimal test case

var settingsTabs = new haxe.ui.containers.TabView();
settingsTabs.onClick=function (e){trace ("TabView clicked"+settingsTabs.pageIndex);};

        var settings = new VBox();
        settings.id="settings";
        settings.text="Settings";
        settingsTabs.addComponent(settings);

        var settingsScroll = new ScrollView();
        settingsScroll.height=450;
        settings.addComponent(settingsScroll);

        var environment = new VBox();
        environment.id="environment";
        environment.text="Environment";
        settingsTabs.addComponent(environment);

        var environmentScroll = new ScrollView();//new VBox();
        environmentScroll.height=450;
        environment.addComponent(environmentScroll);
//iterates over XML
for (elem in environmentNode.elements) {
                trace(elem.x);
                var environmentElements=elem.x;
                trace(environmentElements.nodeName);
                var entry = new HBox();

                for (para in environmentElements.attributes()){
                    trace("attribute: "+para+" value: "+environmentElements.get(para));

                    if (para=="fPath"){
                        trace("fptah found");
                        var hbox=new HBox();
                        var vbox=new VBox();
                        var image = new haxe.ui.components.Image();
                        image.width=160;
                        image.paddingBottom=10;

                        if (Assets.exists(environmentElements.get(para))) {

                            Assets.getBitmapData(environmentElements.get(para));

                        } else {
                            //try to load asynchronously

                            BitmapData.loadFromFile(myDir+"/"+environmentElements.get(para))
                                .onComplete(function(bitmapData){

                                    if (bitmapData!=null){
                                        var bitmap = new Bitmap (bitmapData);

                                        image.addChild (drawScaled(bitmapData, 160,120));

                                    }
                                    else{
                                        trace("no bitmap") ; 
                                    }
                                });

                        }
                        vbox.addComponent(image);
                        hbox.addComponent(vbox);
                        entry.addComponent(hbox);

                    }else{

                        var tFLabel= new haxe.ui.components.Label();
                        tFLabel.text=para;
                        var tF= new haxe.ui.components.TextField();
                        tF.text=environmentElements.get(para);

                        entry.addComponent(tFLabel);
                        entry.addComponent(tF);

                    }

                    environmentScroll.addComponent(entry);

                }
            }

Your Environment

OSX 10.12.6 lime 5.6.0 openfl 6.2.0 hxcpp 3.4.188 Haxe 3.4.2

ianharrigan commented 6 years ago

Is there any chance you could try this the validation branch of haxeui-core and the validation branch of whatever backend you are using?

sumo961 commented 6 years ago

I tried. Maybe a bit faster, but still spinning beach ball.

On Sat, Oct 7, 2017 at 1:33 PM, Ian Harrigan notifications@github.com wrote:

Is there any chance you could try this the validation branch of haxeui-core and the validation branch of whatever backend you are using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haxeui/haxeui-core/issues/176#issuecomment-334928788, or mute the thread https://github.com/notifications/unsubscribe-auth/AKoFQHe8d58l3pKXvzGQAOKwHL0jmGTTks5sp2F0gaJpZM4PxTr_ .

aW4KeNiNG commented 6 years ago

Could you create a zip file with the minimal test case and the files needed?

sumo961 commented 6 years ago

I'm happy to do that, but would prefer a private email address to send this to. Could you send me one?

On Sun, Oct 8, 2017 at 8:49 PM, Pablo Martin notifications@github.com wrote:

Could you create a zip file with the minimal test case and the files needed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haxeui/haxeui-core/issues/176#issuecomment-335029243, or mute the thread https://github.com/notifications/unsubscribe-auth/AKoFQFWLbDcgmxLXxmSVac3Z7ZndfgVTks5sqRlMgaJpZM4PxTr_ .

aW4KeNiNG commented 6 years ago

You can see it on my profile https://github.com/aW4KeNiNG

ianharrigan commented 6 years ago

Same for me: https://github.com/ianharrigan :)

ianharrigan commented 6 years ago

Is this still an issue?

sumo961 commented 6 years ago

Speed is much improved, but still not instantaneous. However, after the first time building it seems to be cached now. For me, it is still not usable yet, as the textfields do not scroll - labels do, though.

On Sat, Nov 18, 2017 at 9:40 AM, Ian Harrigan notifications@github.com wrote:

Is this still an issue?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haxeui/haxeui-core/issues/176#issuecomment-345430837, or mute the thread https://github.com/notifications/unsubscribe-auth/AKoFQKUfiztvKl8qs7zW73LRpMzzATq_ks5s3qYggaJpZM4PxTr_ .

ianharrigan commented 6 years ago

Does textarea work now with the latest from GIT?

sumo961 commented 6 years ago

Problem still there. See screenshot - labels scroll, text boxes do not

On Tue, Nov 21, 2017 at 8:21 AM, Ian Harrigan notifications@github.com wrote:

Does textarea work now with the latest from GIT?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/haxeui/haxeui-core/issues/176#issuecomment-345938685, or mute the thread https://github.com/notifications/unsubscribe-auth/AKoFQKN896lwlpilG9AZ4b0MSN7Fljyfks5s4nnngaJpZM4PxTr_ .

ianharrigan commented 6 years ago

Cant see a screen shot...