Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1290

Slow Model.createList()

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Jena 3.0.1, Jena 3.2.0
    • Fix Version/s: Jena 3.3.0
    • Component/s: Core
    • Labels:
      None
    • Environment:

      OpenJDK 1.8.0.121-b13

      Description

      Model.createList(Iterator) is slow for large list sizes. Starting at 128 nodes, creating a list from an ArrayList iterator takes ~3.6ms and the time goes up to 182ms for 1024 nodes. Creating the RDF list by hand and then doing .as(RDFList.class) for the 1024-nodes tests takes only 1.2ms. I will attach a MWE.

      Going through the code, the cause seems to be that RDFListImpl.with() , which is called for every member added, will always walk the entire list to get the last node. It mentions a possible cache for that, but it is not implemented. I wrote a patch for this issue replacing ModelCom.createList() implementation. I could not find tests for createList, so I added three simple ones to TestModel.

      PS: I'm having a classpath issue with jena-arq tests on mvn clean install, so I could only run tests for jena-core. Are there more specific instructions somewhere for building and testing jena?

        Attachments

        1. JENA-1290.patch
          3 kB
          Alexis Armin Huf
        2. jena-slow-rdflist.tar.gz
          9 kB
          Alexis Armin Huf
        3. mvn-clean-install.log.gz
          336 kB
          Alexis Armin Huf
        4. mvn-clean-install-arq.log.gz
          154 kB
          Alexis Armin Huf
        5. mvn-clean-install-arq-JenaSystem.log.gz
          63 kB
          Alexis Armin Huf

          Activity

            People

            • Assignee:
              andy Andy Seaborne
              Reporter:
              alexishuf Alexis Armin Huf
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: