Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › Is there a maximum size for imported Javascript?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7031

    Rohan

    I’m trying to build a word game, and I’m using the YAWL word list (http://www.cs.duke.edu/csed/data/yawl-0.3.2/). I’ve set the word list up as a JS array like so:

    var yawlWordList = [
        //266k more lines of this
        "sample1",
        "sample2"
    ];

     

    When I import the entire word list, the app logs look like it is about to launch and then just fail.  If I trim the word list down to five entries it works just fine.

     

    Is there a memory limit, and if so, is it safe to increase it (if possible)?

     

    Thanks much in advance!

     

    #7079

    Christian
    Felgo Team

    Hi Rohan,

    I’m not aware of a memory limit for the JS scope in QML. Maybe you can also ask this question over at the Qt support forums, as it is not specific to Felgo?

    As a workaround, you could split up your file into more smaller ones and store it as a JS map not an array, which simplifies finding.

    Cheers,

    Chris

    #7089

    Rohan

    Thanks for the info, Christian.  I’ll follow up with the Qt team at some point.  For the time being, I got it working by converting it to JSON, and using FileUtils to read it.  The code if anyone is interested:

     

    Component.onCompleted: {
        var wordListUrl = Qt.resolvedUrl("Data/YAWL.json");
        wordList = JSON.parse(fileUtils.readFile(wordListUrl.toString()));
    }
    
    function doesWordExist(word) {
        if (wordList.indexOf(word.toLowerCase()) >= 0) {
            return true;
        }
    
        return false;
    }

    The check function is actually really slow, and your plan of splitting it up is definitely the way to go.  Creating an indexed hash would speed it up immensely, I’m thinking.

     

    Once I get a utility for breaking the index down, I’ll post that as well.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded